Add Sentry (#19)
* add sentry * add sentry * better log web3proxy * Add managing and worker on sentry * better log web3proxy
This commit is contained in:
78
src/Managing.Core/Exceptions/CustomExceptions.cs
Normal file
78
src/Managing.Core/Exceptions/CustomExceptions.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
namespace Managing.Core.Exceptions;
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when validation fails (maps to 400 Bad Request)
|
||||
/// </summary>
|
||||
public class ValidationException : Exception
|
||||
{
|
||||
public ValidationException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ValidationException(string message, Exception innerException) : base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a resource is not found (maps to 404 Not Found)
|
||||
/// </summary>
|
||||
public class NotFoundException : Exception
|
||||
{
|
||||
public NotFoundException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public NotFoundException(string resourceType, string identifier)
|
||||
: base($"{resourceType} with identifier '{identifier}' was not found.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when the user does not have permission (maps to 403 Forbidden)
|
||||
/// </summary>
|
||||
public class ForbiddenException : Exception
|
||||
{
|
||||
public ForbiddenException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public ForbiddenException() : base("You do not have permission to access this resource.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when there is a conflict with the current state (maps to 409 Conflict)
|
||||
/// </summary>
|
||||
public class ConflictException : Exception
|
||||
{
|
||||
public ConflictException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when a rate limit is exceeded (maps to 429 Too Many Requests)
|
||||
/// </summary>
|
||||
public class RateLimitExceededException : Exception
|
||||
{
|
||||
public RateLimitExceededException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
|
||||
public RateLimitExceededException() : base("Rate limit exceeded. Please try again later.")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exception thrown when an external service is unavailable (maps to 503 Service Unavailable)
|
||||
/// </summary>
|
||||
public class ServiceUnavailableException : Exception
|
||||
{
|
||||
public ServiceUnavailableException(string message) : base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user