public static JsonHalExceptionClientHandler GetInstance()
 {
     if (_instance == null)
     {
         _instance = new JsonHalExceptionClientHandler();
     }
     return(_instance);
 }
        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);
        }
        private void FillExceptions()
        {
            Handlers = new List <BaseExceptionClientHandler>();
            Handlers.Add(SecurityExceptionClientHandler.GetInstance());
            Handlers.Add(HalExceptionClientHandler.GetInstance());
            Handlers.Add(JsonHalExceptionClientHandler.GetInstance());

            BaseExceptionClientHandler _handler;

            for (int i = 0; i <= Handlers.Count(); i++)
            {
                _handler = Handlers.ElementAt(i);
                if (i + 1 == Handlers.Count())
                {
                    break;
                }
                _handler.Mychainhandler = Handlers.ElementAt(i + 1);
            }
        }