Пример #1
0
 public override IApiExceptions HandleExceptions(Exception ex)
 {
     if (ex is ApiException)
     {
         return((ApiException)ex);
     }
     return(Mychainhandler.HandleExceptions(ex));
 }
Пример #2
0
 public override CompositeFillErrors HandleExceptions(Exception ex)
 {
     if (ex is SecurityExceptionClientHandler)
     {
         return(Run(ex));
     }
     return(Mychainhandler.HandleExceptions(ex));
 }
Пример #3
0
 public override CompositeFillErrors HandleExceptions(Exception ex)
 {
     if (ex.InnerException is JsonErrorHandler)
     {
         return(Run(ex));
     }
     return(Mychainhandler.HandleExceptions(ex));
 }
 public override CompositeFillErrors HandleExceptions(Exception ex)
 {
     if (ex is AggregateException && ex.InnerException is HalHttpRequestException)
     {
         return(Run(ex));
     }
     return(Mychainhandler.HandleExceptions(ex));
 }
Пример #5
0
 public override IApiExceptions HandleExceptions(Exception ex)
 {
     if (ex is DbEntityValidationException)
     {
         DbEntityValidationException e = (DbEntityValidationException)ex;
         string outputLines            = "";
         foreach (var eve in e.EntityValidationErrors)
         {
             outputLines += string.Format(
                 "{0}: La entidad del tipo \"{1}\" con estado \"{2}\" tiene los siguientes errores:", DateTime.Now,
                 eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 outputLines += string.Format((string.Format("- Propiedad: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage)));
             }
         }
         return(new ApiDataException(e.HResult, outputLines, System.Net.HttpStatusCode.InternalServerError, "Http"));
     }
     return(Mychainhandler.HandleExceptions(ex));
 }