mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
started to remove iisexpress.
This commit is contained in:
parent
40f3a8663d
commit
68128809c9
39 changed files with 383 additions and 820 deletions
33
NzbDrone.Api/ErrorManagement/ErrorHandler.cs
Normal file
33
NzbDrone.Api/ErrorManagement/ErrorHandler.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Linq;
|
||||
using Nancy;
|
||||
using Nancy.ErrorHandling;
|
||||
using NzbDrone.Api.Extentions;
|
||||
|
||||
namespace NzbDrone.Api.ErrorManagement
|
||||
{
|
||||
public class ErrorHandler : IStatusCodeHandler
|
||||
{
|
||||
public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Handle(HttpStatusCode statusCode, NancyContext context)
|
||||
{
|
||||
if (statusCode == HttpStatusCode.SeeOther || statusCode == HttpStatusCode.OK)
|
||||
return;
|
||||
|
||||
if (statusCode == HttpStatusCode.Continue)
|
||||
{
|
||||
context.Response = new Response { StatusCode = statusCode };
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.Response.ContentType == "text/html" || context.Response.ContentType == "text/plain")
|
||||
context.Response = new ErrorModel
|
||||
{
|
||||
Message = statusCode.ToString()
|
||||
}.AsResponse(statusCode);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue