@nova-ts/core
Version:
A serverside framework used to build scalable application
32 lines (30 loc) • 972 B
JavaScript
import {
ExceptionRegistry
} from "./chunk-ZRXV7W7K.js";
// src/Resolver/NovaExceptionResolver.ts
var NovaExceptionResolver = class {
/**
* Resolves the given error by invoking a matching exception handler if registered.
*
* If no handler is registered for the specific exception type, it sends a generic
* 500 response with the error message.
*
* @param err - The error that was thrown during request handling.
* @param request - The current Nova request object.
* @param response - The current Nova response object.
*/
static resolve(err, request, response) {
const handler = ExceptionRegistry.get(err.constructor);
if (handler) {
return handler.method.call(handler.constructor, err, request, response);
}
response.status(err.statusCode || 500).json({
success: false,
message: err.message || "Internal Server Error"
});
}
};
export {
NovaExceptionResolver
};
//# sourceMappingURL=chunk-SE6QT5D5.js.map