예제 #1
0
        public static string GetErrorTypeByCode(int errorCode)
        {
            if (mapByType == null)
            {
                LoadErrorMap();
            }
            SDBError errObj = mapByCode[errorCode];

            if (errObj != null)
            {
                return(errObj.ErrorType);
            }
            return(SequoiadbConstants.UNKNOWN_TYPE);
        }
예제 #2
0
        public static string GetErrorDescriptionByCode(int errorCode)
        {
            if (mapByType == null)
            {
                LoadErrorMap();
            }
            SDBError errObj = mapByCode[errorCode];

            if (errObj != null)
            {
                return(errObj.ErrorDescription);
            }
            return(SequoiadbConstants.UNKONWN_DESC);
        }
예제 #3
0
        public static int GetErrorCodeByType(string errorType)
        {
            if (mapByType == null)
            {
                LoadErrorMap();
            }
            SDBError errObj = mapByType[errorType];

            if (errObj != null)
            {
                return(errObj.ErrorCode);
            }
            return(SequoiadbConstants.UNKNOWN_CODE);
        }
예제 #4
0
        private static void LoadErrorMap()
        {
            mapByType = new Dictionary<string, SDBError>();
            mapByCode = new Dictionary<int, SDBError>();

            foreach (int errCode in Enum.GetValues(typeof(Errors.errors)))
            {
                SDBError error = new SDBError();
                string errType = Enum.GetName(typeof(Errors.errors), errCode);
                error.ErrorCode = errCode;
                error.ErrorType = errType;
                error.ErrorDescription = Errors.descriptions[(-errCode) - 1];

                mapByCode.Add(errCode, error);
                mapByType.Add(errType, error);
            }
        }
예제 #5
0
        private static void LoadErrorMap()
        {
            mapByType = new Dictionary <string, SDBError>();
            mapByCode = new Dictionary <int, SDBError>();

            foreach (int errCode in Enum.GetValues(typeof(Errors.errors)))
            {
                SDBError error   = new SDBError();
                string   errType = Enum.GetName(typeof(Errors.errors), errCode);
                error.ErrorCode        = errCode;
                error.ErrorType        = errType;
                error.ErrorDescription = Errors.descriptions[(-errCode) - 1];

                mapByCode.Add(errCode, error);
                mapByType.Add(errType, error);
            }
        }