@curveball/kernel
Version:
Curveball is a framework writting in Typescript for Node.js
28 lines • 833 B
JavaScript
/**
* This middleware simply triggers a 'NotFound' error.
*
* This is a utility middleware that's automatically added to the middleware
* stack to be 'last'.
*
* The purpose of this mw is that if no other middlewares did anything to
* handle a request, we automatically respond with a 404.
*/
class NoHandler extends Error {
detail;
httpStatus;
instance = null;
title;
type;
constructor() {
super();
this.type = 'https://curveballjs.org/errors/no-handler';
this.title = 'No handler for this request';
this.detail = 'This server doesn\'t know what to do with your request. Did you make a typo?';
this.message = this.title;
this.httpStatus = 404;
}
}
export default function mw(ctx) {
throw new NoHandler();
}
//# sourceMappingURL=not-found.js.map