From the graph we can find that, $f(-5)=f(-1)=f(9)=0$




Question: NancyFX - Return custom error response on uncaught exception
Answer: Gah, so this was a CORS issue.

I'm automatically adding the CORS headers to the response:

    protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
    {
        pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =&gt;
        {
            ctx.Response.WithHeader("Access-Control-Allow-Origin", "*")
                .WithHeader("Access-Control-Allow-Methods", "POST,GET")
                .WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type");
        });

        pipelines.OnError.AddItemToEndOfPipeline((ctx, exc) =&gt;
        {
            if (exc != null)
            {
                throw exc;
            }

            return HttpStatusCode.InternalServerError;
        });

        base.RequestStartup(container, pipelines, context);
    }


But when the response is replaced in my status code handler I need to set these headers again:

public class JsonErrorStatusCodeHandler : IStatusCodeHandler
{
    public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
    {
        if (statusCode != HttpStatusCode.InternalServerError)
        {
            return false;
        }

        var exception = context.GetException();

        return exception != null;
    }


    public void Handle(HttpStatusCode statusCode, NancyContext context)
    {
        var exception = context.GetException();

        JsonResponse response = new JsonResponse(string.Format("{0}:{1}", exception, exception.Message), new DefaultJsonSerializer());

        response.StatusCode = HttpStatusCode.InternalServerError;

        context.Response = response;

        context.Response.WithHeader("Access-Control-Allow-Origin", "*")
            .WithHeader("Access-Control-Allow-Methods", "POST,GET")
            .WithHeader("Access-Control-Allow-Headers", "Accept, Origin, Content-type");
    }
}