diff --git a/src/http/errors/bad_request_error.js b/src/http/errors/bad_request_error.js new file mode 100644 index 0000000..a909584 --- /dev/null +++ b/src/http/errors/bad_request_error.js @@ -0,0 +1,8 @@ +class bad_request_error extends Error { + constructor(message) { + super(message) + this.status_code = 400 + } +} + +module.exports = bad_request_error \ No newline at end of file diff --git a/src/http/errors/conflict_error.js b/src/http/errors/conflict_error.js new file mode 100644 index 0000000..6566377 --- /dev/null +++ b/src/http/errors/conflict_error.js @@ -0,0 +1,8 @@ +class conflict_error extends Error { + constructor(message) { + super(message) + this.status_code = 409 + } +} + +module.exports = conflict_error \ No newline at end of file diff --git a/src/http/errors/forbidden_error.js b/src/http/errors/forbidden_error.js new file mode 100644 index 0000000..47ecde2 --- /dev/null +++ b/src/http/errors/forbidden_error.js @@ -0,0 +1,8 @@ +class forbidden_error extends Error { + constructor(message) { + super(message) + this.status_code = 403 + } +} + +module.exports = forbidden_error \ No newline at end of file diff --git a/src/http/errors/not_found_error.js b/src/http/errors/not_found_error.js new file mode 100644 index 0000000..12e9fb9 --- /dev/null +++ b/src/http/errors/not_found_error.js @@ -0,0 +1,8 @@ +class not_found_error extends Error { + constructor(message) { + super(message) + this.status_code = 404 + } +} + +module.exports = not_found_error \ No newline at end of file diff --git a/src/http/errors/server_error.js b/src/http/errors/server_error.js new file mode 100644 index 0000000..d83d42c --- /dev/null +++ b/src/http/errors/server_error.js @@ -0,0 +1,8 @@ +class server_error extends Error { + constructor(message) { + super(message) + this.status_code = 500 + } +} + +module.exports = server_error \ No newline at end of file diff --git a/src/http/errors/unauthorized_error.js b/src/http/errors/unauthorized_error.js new file mode 100644 index 0000000..d71ff07 --- /dev/null +++ b/src/http/errors/unauthorized_error.js @@ -0,0 +1,8 @@ +class unauthorized_error extends Error { + constructor(message) { + super(message) + this.status_code = 401 + } +} + +module.exports = unauthorized_error \ No newline at end of file diff --git a/src/http_client.js b/src/http/http_client.js similarity index 100% rename from src/http_client.js rename to src/http/http_client.js