Exemplo n.º 1
0
 public static string Error(ExceptionEnum type, string description = null)
 {
     return(JsonConvert.SerializeObject(new ErrorsResult(false, type.ToString(), description)));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 
        /// Description: 抛出异常错误信息
        /// Author:Liudpc
        /// Create Date: 2010/12/15 16:23:44
        /// </summary>
        /// <param name="exc"></param>
        /// <param name="sMessage"></param>
        public static void ThrowException(ExceptionEnum exc, string sMessage)
        {
            Exception e = new Exception("ExceptionEnum:" + exc.ToString() + ";ExceptionMessage:"+sMessage);

            throw e;
        }
Exemplo n.º 3
0
Arquivo: CPU.cs Projeto: richgieg/rx64
        // processor's exception mechanism
        private void RaiseException(ExceptionEnum Exception, ExceptionDetailEnum ExceptionDetail)
        {
            string exception;
            string message = string.Empty;

            if ((Exception == ExceptionEnum.GeneralProtection) && (opMode == OpModeEnum.RealAddressMode))
                exception = "SegmentOverrun";
            else
                exception = Exception.ToString();

            message = "CPU Exception Occurred!\n\nException #" + ((int)Exception).ToString() + " - " + exception;

            if (Exception != ExceptionEnum.InvalidOpcode)
            {
                if (opMode == OpModeEnum.RealAddressMode)
                {
                    message += "\n\nCS : IP = " + string.Format("0x{0:X4} : 0x{1:X4}", cs, old_ip);
                }
                else if (opMode == OpModeEnum.ProtectedMode)
                {
                    message += "\n\nCS : EIP = " + string.Format("0x{0:X4} : 0x{1:X8}", cs, old_eip);
                }
            }
            else
            {
                switch (opMode)
                {
                    case OpModeEnum.RealAddressMode:
                        message += String.Format("\n\nOpcode = 0x{0:X2}", GetByte(SegmentEnum.CS, GetInstructionPointer(prefixLength)));
                        message += String.Format("\nCS : IP = 0x{0:X4} : 0x{1:X4}", cs, GetInstructionPointer(prefixLength));
                        break;

                    case OpModeEnum.ProtectedMode:
                        message += String.Format("\n\nOpcode = 0x{0:X2}", GetByte(SegmentEnum.CS, GetInstructionPointer(prefixLength)));
                        message += String.Format("\nCS : IP = 0x{0:X4} : 0x{1:X8}", cs, GetInstructionPointer(prefixLength));
                        break;

                    case OpModeEnum.IA32e_CompatibilityMode:
                        break;

                    default:    // OpModeEnum.IA32e_64bitMode
                        break;
                }
            }

            if (ExceptionDetail != ExceptionDetailEnum.Null)
                message += "\n\n\"" + exceptionDetailTable[(int)ExceptionDetail] + "\"";

            throw new System.Exception(message);
        }
Exemplo n.º 4
0
 public AccountException(ExceptionEnum reason) : base(reason.ToString())
 {
 }
Exemplo n.º 5
0
 public AccountException(ExceptionEnum reason) : base(reason.ToString())
 {
     Console.WriteLine(reason.ToString());
 }