GithubHelp home page GithubHelp logo

fallenmanrisesup / nestjs-flub Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nestjsx/nestjs-flub

0.0 0.0 0.0 931 KB

Pretty Error ๐Ÿ˜ซ Stack Viewer for NestJS Framework ๐Ÿ› ๏ธ

License: MIT License

HTML 89.50% TypeScript 10.50%

nestjs-flub's Introduction

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 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');
  }
}

Configuration

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 }))

Theming

copy /src/themes/error.default.mustache and play

TODO

  • Write Tests
  • list syntax required

Contributing

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

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

nestjs-flub's People

Contributors

0xflotus avatar bashleigh avatar greenkeeper[bot] avatar killbox-code avatar lsurma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.