Guest User

Untitled

a guest
Jul 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. protected override void OnException(
  2. ExceptionContext filterContext
  3. )
  4. {
  5. try
  6. {
  7. Error error = ControllerCommon.ProcessException(filterContext);
  8.  
  9. // return error
  10. filterContext.Result = HandleError(error.Type);
  11. filterContext.ExceptionHandled = true;
  12. }
  13. catch (Exception ex)
  14. {
  15. Logger.Instance.LogImportantInformation(ex.Message, 0, Constants.EventSourcePortal);
  16. }
  17. }
  18.  
  19. #endregion
  20.  
  21. #region Private Methods and Members
  22.  
  23. private ActionResult HandleError()
  24. {
  25. return HandleError(Error.ErrorType.Unknown);
  26. }
  27.  
  28. private ActionResult HandleError(
  29. Error.ErrorType errorType
  30. )
  31. {
  32. // set return status code
  33. HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
  34.  
  35. Logger.Instance.LogImportantInformation(((int)errorType).ToString(CultureInfo.InvariantCulture), 0, Constants.EventSourcePortal);
  36.  
  37. // return error type
  38. return Content(((int)errorType).ToString(CultureInfo.InvariantCulture), "text/plain");
  39. }
Add Comment
Please, Sign In to add comment