Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nestjs-flub

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestjs-flub

Pretty Error Stack Viewer for NestJS Framework

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Coverage Status

Nestjs Flub

Pretty ErrorHandler 😫, Stack Viewer for Nestjs Framework 🛠️

it's just a simple Filter for Catching the Errors

Features

  1. HTML reporter

  2. JSON reporter, if request accepts a json instead of text/html.

  3. Sorted frames of error stack.

  4. Themes

Dark Theme

dark

Light Theme

light

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();

Keywords

FAQs

Package last updated on 11 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc