|
|
@ -1,4 +1,5 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Data.SQLite;
|
|
|
|
using FluentValidation;
|
|
|
|
using FluentValidation;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using Nancy;
|
|
|
|
using Nancy;
|
|
|
@ -48,6 +49,21 @@ namespace NzbDrone.Api.ErrorManagement
|
|
|
|
}.AsResponse((HttpStatusCode)clientException.StatusCode);
|
|
|
|
}.AsResponse((HttpStatusCode)clientException.StatusCode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (context.Request.Method == "PUT" || context.Request.Method == "POST")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var sqLiteException = exception as SQLiteException;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sqLiteException != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (sqLiteException.Message.Contains("constraint failed"))
|
|
|
|
|
|
|
|
return new ErrorModel
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Message = exception.Message,
|
|
|
|
|
|
|
|
}.AsResponse(HttpStatusCode.Conflict);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_logger.FatalException("Request Failed", exception);
|
|
|
|
_logger.FatalException("Request Failed", exception);
|
|
|
|
|
|
|
|
|
|
|
|
return new ErrorModel
|
|
|
|
return new ErrorModel
|
|
|
|