Error extends javascript
Custom errors throw, the errors look like this
Throw this error if it is a body property error.
import { BodyPropertyError } from "errors-stack";
throw new BodyPropertyError("message");
Throw this error if it is a forbidden error.
import { ForbiddenError } from "errors-stack";
throw new ForbiddenError("message");
Throw this error if it is a health error.
import { HealthError } from "errors-stack";
throw new HealthError("message");
Throw this error if it is a internal server error.
import { InternalServiceError } from "errors-stack";
throw new InternalServiceError("message");
Throw this error if it is a not found error.
import { NotFoundError } from "errors-stack";
throw new NotFoundError("message");
Throw this error if it is a param error.
import { ParamPropertyError } from "errors-stack";
throw new ParamPropertyError("message");
Throw this error if it is a query error.
import { QueryPropertyError } from "errors-stack";
throw new QueryPropertyError("message");
Throw this error if has many requests.
import { TooManyRequestsError } from "errors-stack";
throw new TooManyRequestsError("message");
Throw this error if has unauthorized situation.
import { UnauthorizedError } from "errors-stack";
throw new UnauthorizedError({ message: "message", status: 401 });
Throw this error if error is unknown.
import { UnknownError } from "errors-stack";
throw new UnknownError({ message: "message", status: 401 });
Throw this error if is an validation error, and array is necessary to throw this error.
import { ValidationError } from "errors-stack";
throw new ValidationError("message", [new BodyPropertyError("message")]);