Add initial implementation of API, database, and user management components.
This commit is contained in:
11
MikrocopApi/Exceptions/AppException.cs
Normal file
11
MikrocopApi/Exceptions/AppException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MikrocopApi.Exceptions;
|
||||
|
||||
public abstract class AppException : Exception
|
||||
{
|
||||
protected AppException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int StatusCode { get; }
|
||||
public abstract string Title { get; }
|
||||
}
|
||||
11
MikrocopApi/Exceptions/BadRequestException.cs
Normal file
11
MikrocopApi/Exceptions/BadRequestException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MikrocopApi.Exceptions;
|
||||
|
||||
public sealed class BadRequestException : AppException
|
||||
{
|
||||
public BadRequestException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StatusCode => StatusCodes.Status400BadRequest;
|
||||
public override string Title => "Bad Request";
|
||||
}
|
||||
11
MikrocopApi/Exceptions/ConflictException.cs
Normal file
11
MikrocopApi/Exceptions/ConflictException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MikrocopApi.Exceptions;
|
||||
|
||||
public sealed class ConflictException : AppException
|
||||
{
|
||||
public ConflictException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StatusCode => StatusCodes.Status409Conflict;
|
||||
public override string Title => "Conflict";
|
||||
}
|
||||
11
MikrocopApi/Exceptions/NotFoundException.cs
Normal file
11
MikrocopApi/Exceptions/NotFoundException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MikrocopApi.Exceptions;
|
||||
|
||||
public sealed class NotFoundException : AppException
|
||||
{
|
||||
public NotFoundException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StatusCode => StatusCodes.Status404NotFound;
|
||||
public override string Title => "Not Found";
|
||||
}
|
||||
11
MikrocopApi/Exceptions/UnauthorizedException.cs
Normal file
11
MikrocopApi/Exceptions/UnauthorizedException.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace MikrocopApi.Exceptions;
|
||||
|
||||
public sealed class UnauthorizedException : AppException
|
||||
{
|
||||
public UnauthorizedException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StatusCode => StatusCodes.Status401Unauthorized;
|
||||
public override string Title => "Unauthorized";
|
||||
}
|
||||
Reference in New Issue
Block a user