@nitrotool/errors 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +24 -0
- package/package.json +1 -1
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createError } from 'h3';
|
|
2
|
+
|
|
3
|
+
const UnauthenticatedError = (message) => createError({ statusCode: 401, statusMessage: "Unauthenticated", message });
|
|
4
|
+
const UnauthorizedError = (message) => createError({ statusCode: 403, statusMessage: "Unauthorized", message });
|
|
5
|
+
const NotFoundError = (message) => createError({ statusCode: 404, statusMessage: "Not found", message });
|
|
6
|
+
const EntityAlreadyExistsError = (message) => createError({
|
|
7
|
+
statusCode: 409,
|
|
8
|
+
statusMessage: "Entity Already Exists",
|
|
9
|
+
message
|
|
10
|
+
});
|
|
11
|
+
const ServerError = (message) => createError({
|
|
12
|
+
statusCode: 500,
|
|
13
|
+
statusMessage: "Internal Server Error",
|
|
14
|
+
message
|
|
15
|
+
});
|
|
16
|
+
const ClientError = (message) => createError({ statusCode: 400, statusMessage: "Client Error", message });
|
|
17
|
+
const UnprocessableEntityError = (message) => createError({
|
|
18
|
+
statusCode: 422,
|
|
19
|
+
statusMessage: "Unprocessable Entity",
|
|
20
|
+
message
|
|
21
|
+
});
|
|
22
|
+
const BadRequestError = (message) => createError({ statusCode: 400, statusMessage: "Bad Request", message });
|
|
23
|
+
|
|
24
|
+
export { BadRequestError, ClientError, EntityAlreadyExistsError, NotFoundError, ServerError, UnauthenticatedError, UnauthorizedError, UnprocessableEntityError };
|