error handling
Introduction
Usage
const { createRoute, createError } = require('light');
const { route } = createRoute('error');
module.exports = route(() => {
throw createError(401, 'sorry, you cannot access this route');
return 'it will not get to me :(';
});{
"statusCode": 401,
"error": "Unauthorized",
"message": "sorry, you cannot access this route"
}Error Object
Last updated
Was this helpful?