Pretty Error Stack Viewer for NestJS Framework
npm install nestjs-flubPretty ErrorHandler 😫, Stack Viewer for Nestjs Framework 🛠️
> it's just a simple Filter for Catching the Errors
1. HTML reporter
2. JSON reporter, if request accepts a json instead of text/html.
3. Sorted frames of error stack.
4. Themes
``bash`
npm install nestjs-flub --save
typescript
import { FlubErrorHandler } from 'nestjs-flub';
@Controller('cats')
@UseFilters(new FlubErrorHandler())
export class CatsController { @Get('/error')
throwError() {
throw new Error('Very Bad Error');
}
}
`Configuration
FlubErrorHandler accepts an optional object to configure the Error Handler. For now, it only has two Options:
`typescript
theme: string; // for themes ['dark', 'light', 'default']
quote: boolean; // for displaying very good quotes
`
example
`typescript
@UseFilters(new FlubErrorHandler({ theme: 'dark', quote:true }))
`
#### Theming
copy /src/themes/error.default.mustache and play
## TODO
- [ ] Write Tests
- [ ] list syntax required ## Contributing
You are welcome to contribute to this project. If you want to add new themes, make a new PR containing the theme and a simple image to represent it
Global filters
Use flub error handler for all controllers
``typescript