Skip to content
This repository was archived by the owner on Jan 24, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions src/Nancy.Hosting.Self/NancyHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,24 +426,31 @@ private void GotCallback(IAsyncResult ar)

private void Process(HttpListenerContext ctx)
{
try
Action<Exception> onError = (e) =>
{
var nancyRequest = this.ConvertRequestToNancyRequest(ctx.Request);
using (var nancyContext = this.engine.HandleRequest(nancyRequest))
this.configuration.UnhandledExceptionCallback.Invoke(e);
};

Action<NancyContext> onComplete = (nancyContext) =>
{
try
{
try
{
ConvertNancyResponseToResponse(nancyContext.Response, ctx.Response);
}
catch (Exception e)
{
this.configuration.UnhandledExceptionCallback.Invoke(e);
}
ConvertNancyResponseToResponse(nancyContext.Response, ctx.Response);
}
catch (Exception e)
{
onError(e);
}
};

try
{
var nancyRequest = this.ConvertRequestToNancyRequest(ctx.Request);
this.engine.HandleRequest(nancyRequest, onComplete, onError);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this overload defined? I think I must be blind, cause I just can't find it 😕

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m on my phone so I can’t be sure, but I believe this is it. Note that this is on the 1.x branch since I was working against stable.

public static void HandleRequest(

}
catch (Exception e)
{
this.configuration.UnhandledExceptionCallback.Invoke(e);
onError(e);
}
}
}
Expand Down