Add Exception middleware

This commit is contained in:
2022-09-01 23:02:49 +01:00
parent 2ac5937096
commit dcf3b1020a
14 changed files with 241 additions and 90 deletions

22
Shared/AppException.cs Normal file
View File

@@ -0,0 +1,22 @@
using System.Net;
namespace Diary.Shared
{
public class AppException : Exception
{
public string Title { get; }
public HttpStatusCode StatusCode { get; }
public AppException(HttpStatusCode statusCode, string title, string message) : base(message)
{
StatusCode = statusCode;
Title = title;
}
public AppException(HttpStatusCode statusCode, string title, string message, Exception innerException) : base(message, innerException)
{
StatusCode = statusCode;
Title = title;
}
}
}