Pretty ErrorHandler 😫, Stack Viewer for Nestjs Framework 🛠️
it's just a simple
Filter
for Catching the Errors
-
HTML reporter
-
JSON reporter, if request accepts a json instead of text/html.
-
Sorted frames of error stack.
-
Themes
npm install nestjs-flub --save
Just add this filter as you used to add any filters
import { FlubErrorHandler } from 'nestjs-flub';
@Controller('cats')
@UseFilters(new FlubErrorHandler())
export class CatsController {
@Get('/error')
throwError() {
throw new Error('Very Bad Error');
}
}
FlubErrorHandler accepts an object as an option to configure the Error Handler
for now it only have two Options
theme: string; // for themes ['dark', 'light', 'default']
quote: boolean; // for displaying very good quotes
example
@UseFilters(new FlubErrorHandler({ theme: 'dark', quote:true }))
copy /src/themes/error.default.mustache
and play
- Write Tests
- list syntax required
You are welcome with this project for contributing, If you have new themes just make a new PR with and simple image for the theme
Use flub error handler for all controllers
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useGlobalFilters(new FlubErrorHandler());
await app.listen(3000);
}
bootstrap();