Exemplo n.º 1
0
 public static ClientCodeHandler GetInstance()
 {
     if (_handler == null)
     {
         _handler = new ClientCodeHandler();
     }
     return(_handler);
 }
        public override CompositeFillErrors Run(Exception ex)
        {
            int    code;
            string message = "";
            JsonHalExceptionClientHandler myex = (JsonHalExceptionClientHandler)ex.InnerException;

            code    = myex.ErrorCode;
            message = myex.ErrorDescription;
            KeyValuePair <int, string> rowerror = ClientCodeHandler.GetInstance().CodeExceptions.FirstOrDefault(t => t.Key.Equals(code));
            CompositeFillErrors        cfe      = new CompositeFillErrors()
            {
                Field = rowerror.Value, Message = message
            };

            return(cfe);
        }
        public override CompositeFillErrors Run(Exception ex)
        {
            int    code;
            string message = "";
            HalHttpRequestException myex = (HalHttpRequestException)ex.InnerException;

            code    = Int32.Parse(myex.Resource.State.Values.First(t => t.Name.Equals("ErrorCode")).Value.ToString());
            message = myex.Resource.State.Values.First(t => t.Name.Equals("ErrorDescription")).Value;
            KeyValuePair <int, string> rowerror = ClientCodeHandler.GetInstance().CodeExceptions.FirstOrDefault(t => t.Key.Equals(code));
            CompositeFillErrors        cfe      = new CompositeFillErrors()
            {
                Field = rowerror.Value, Message = message
            };

            return(cfe);
        }