0.1.2 • Published 12 months ago
nestjs-flub v0.1.2
Pretty ErrorHandler 😫, Stack Viewer for Nestjs Framework 🛠️
it's just a simple
Filter
for Catching the Errors
Features
HTML reporter
JSON reporter, if request accepts a json instead of text/html.
Sorted frames of error stack.
Themes
Dark Theme
Light Theme
Install
npm install nestjs-flub --save
Simple Usage
Just add this filter as you would any filter:
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:
theme: string; // for themes ['dark', 'light', 'default']
quote: boolean; // for displaying very good quotes
example
@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
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useGlobalFilters(new FlubErrorHandler());
await app.listen(3000);
}
bootstrap();
0.1.2
12 months ago
0.2.0
5 years ago
0.1.0
6 years ago
0.0.6-beta
7 years ago
0.0.5-beta
7 years ago
0.0.4-beta
7 years ago
0.0.3-beta
7 years ago
0.0.2-beta
7 years ago
0.0.1-beta
7 years ago