Skip to content

HandleError not hit #2

@bonesoul

Description

@bonesoul

As stated in https://github.com/bernos/Nancy.CustomErrors, I've overriden handleerror but somehow it's not hit (have put a breakpoint there)

    public class ErrorConfiguration : CustomErrorsConfiguration
    {
        public ErrorConfiguration()
        {
            // Map error status codes to custom view names
            ErrorViews[HttpStatusCode.NotFound] = "error";
            ErrorViews[HttpStatusCode.InternalServerError] = "error";
            ErrorViews[HttpStatusCode.Forbidden] = "error";
        }
   public override ErrorResponse HandleError(NancyContext context, Exception ex, ISerializer serializer)
        {
            var error = new Error
            {
                FullException = ex.ToString(),
                Message = ex.Message
            };

            return new ErrorResponse(error, serializer).WithStatusCode(HttpStatusCode.InternalServerError) as ErrorResponse;
        }
    }

        protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
        {            
            CustomErrors.Enable(pipelines, new ErrorConfiguration());
        }

any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions