Esempio n. 1
0
        public HttpExceptionResponse(Exception e)
        {
            HttpErrorCodeException eTyped = e as HttpErrorCodeException;

            ResponseCode = (eTyped != null) ? eTyped.ReponseCode : HttpResponseCode.S_500_InternalError;
            Body         = string.Format("<h1>{0} {1}</h1>We are sorry. Something happened.<br>Maybe this can help: {2}",
                                         (int)ResponseCode,
                                         ResponseCode.ToReasonPhrase(),
                                         e.Message);
        }
Esempio n. 2
0
        protected void AddErrors(HttpErrorCodeException exception)
        {
            if (exception.ValidationErrors == null)
            {
                // All errors with description should be propagated by MainServiceException so this is fallback:
                ModelState.AddModelError(string.Empty, Localizer.Translate("unknown-error-msg", "Error"));
                return;
            }

            foreach (var error in exception.ValidationErrors)
            {
                ModelState.AddModelError(string.Empty, error.Message);
            }
        }