26 lines
802 B
C#
26 lines
802 B
C#
using Shared.Contracts.Enums;
|
|
|
|
namespace Shared.Contracts.Constants;
|
|
|
|
public record Error(ErrorCode Code, string Message);
|
|
|
|
public static class Errors
|
|
{
|
|
public static readonly Error Success =
|
|
new(ErrorCode.Success, "Success");
|
|
|
|
public static readonly Error BadRequest =
|
|
new(ErrorCode.BadRequest, "Invalid request.");
|
|
|
|
public static readonly Error ValidationFailed =
|
|
new(ErrorCode.ValidationFailed, "Validation failed.");
|
|
|
|
public static readonly Error Unauthorized =
|
|
new(ErrorCode.Unauthorized, "Unauthorized access.");
|
|
|
|
public static readonly Error NotFound =
|
|
new(ErrorCode.NotFound, "Resource not found.");
|
|
|
|
public static readonly Error InternalServerError =
|
|
new(ErrorCode.InternalServerError, "An unexpected error occurred.");
|
|
} |