Exemplo n.º 1
0
        static string GetErrorText(int hr)
        {
            string        _text   = "";
            int           _length = 160;
            StringBuilder sb      = new StringBuilder(_length);

            try
            {
                if (Quartz.AMGetErrorText(hr, sb, _length) > 0)
                {
                    _text = sb.ToString();
                }
            }
            catch
            {
            }

            return(_text);
        }
Exemplo n.º 2
0
        public static string GetErrorMessageForException(Exception ex, bool detailed)
        {
            string msg = (detailed) ? ex.ToString() : ex.Message;

            if (ex is COMException)
            {
                const int MAX_ERROR_TEXT_LEN = 255;

                // Make a buffer to hold the string
                StringBuilder sb = new StringBuilder(MAX_ERROR_TEXT_LEN, MAX_ERROR_TEXT_LEN);

                COMException cex = ex as COMException;

                if (Quartz.AMGetErrorText(cex.ErrorCode, sb, MAX_ERROR_TEXT_LEN) > 0)
                {
                    msg = sb.ToString();
                }
            }
            return(msg);
        }