static Exception GetException(MonoBtlsSslError status)
        {
            var error = MonoBtlsError.GetError();
            var text  = MonoBtlsError.GetErrorString(error);

            return(new MonoBtlsException("{0} {1}", status, text));
        }
Exemple #2
0
        static Exception GetException(MonoBtlsSslError status)
        {
            string file;
            int    line;
            var    error = MonoBtlsError.GetError(out file, out line);

            if (error == 0)
            {
                return(new MonoBtlsException(status));
            }

            var reason = MonoBtlsError.GetErrorReason(error);

            if (reason > 0)
            {
                return(new TlsException((AlertDescription)reason));
            }

            var text = MonoBtlsError.GetErrorString(error);

            string message;

            if (file != null)
            {
                message = string.Format("{0} {1}\n  at {2}:{3}", status, text, file, line);
            }
            else
            {
                message = string.Format("{0} {1}", status, text);
            }
            return(new MonoBtlsException(message));
        }