Major Backend Single Responsibility Update part 1

This commit is contained in:
X4Lo committed 2025-01-25 04:29:42 +01:00
1 parent 65177c7553
commit cbdffb21e3
41 files changed
+1723 -888

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 400 Bad Request.
* This error indicates that the server cannot process the request due to a client error.
*/
class BadRequestError extends CustomError {
constructor(message) {
super(message);
}
statusCode() {
return 400; // Bad Request
}
}
module.exports = BadRequestError;
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 409 Conflict.
* This error indicates that the request could not be processed due to a conflict with the current state of the resource.
*/
class ConflictError extends CustomError {
constructor(message) {
super(message);
+4
View File
@@ -1,3 +1,7 @@
/**
* Base class for custom HTTP errors.
* Extend this class to create specific error types with custom properties and behavior.
*/
class CustomError extends Error {
constructor(message) {
super(message);
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 403 Forbidden.
* This error indicates that the client does not have permission to access the requested resource.
*/
class ForbiddenError extends CustomError {
constructor(message) {
super(message);
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 500 Internal Server Error.
* This error indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.
*/
class InternalServerError extends CustomError {
constructor(message) {
super(message);
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 404 Not Found.
* This error indicates that the requested resource could not be found on the server.
*/
class NotFoundError extends CustomError {
constructor(message) {
super(message);
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 401 Unauthorized.
* This error indicates that the request requires user authentication.
*/
class UnauthorizedError extends CustomError {
constructor(message) {
super(message);
+4
View File
@@ -1,5 +1,9 @@
const CustomError = require('./CustomError');
/**
* Represents an error for HTTP 422 Unprocessable Entity.
* This error indicates that the server understands the request but cannot process it due to semantic validation errors.
*/
class ValidationError extends CustomError {
constructor(message) {
super(message);