@geniucode/common-utils
Version:
Common utils
20 lines • 842 B
JavaScript
import { CustomError } from './custom-error';
import { ErrorStatusCode } from '../config/errors';
/**
* The HyperText Transfer Protocol (HTTP) 405 Method Not Allowed response status code indicates
* that the request method is known by the server but is not supported by the target resource.
*/
export class RequestMethodNotAllowedError extends CustomError {
constructor(message = '[ERROR] HTTP Method Not Allowed') {
super(message, ErrorStatusCode.requestMethodNotAllowed);
// Only because we are extending a built in class
Object.setPrototypeOf(this, RequestMethodNotAllowedError.prototype);
}
setStatusCode(statusCode) {
this.statusCode = statusCode;
}
serializeErrors() {
return [{ message: this.message }];
}
}
//# sourceMappingURL=request-method-not-allowed-error.js.map