Giter Site home page Giter Site logo

onur-ozkan / nestjs-enlighten Goto Github PK

View Code? Open in Web Editor NEW
78.0 3.0 9.0 280 KB

laravel-ignition like error page for NestJS Framework

Home Page: https://npmjs.com/package/nestjs-enlighten

License: MIT License

TypeScript 71.02% EJS 28.98%
error-monitoring error-handler error-page nestjs nestjs-module nestjs-framework

nestjs-enlighten's Introduction

No longer maintained

NestJS Enlighten

Test and Build Automated NPM Pusher Package Version License

A laravel-ignition like error page for Nestjs Framework

About

Nest Enlighten is a module for Nest Framework. With this module, you can render friendly error pages for spesific or global endpoints that includes a lot of detailed values behind the hood. Not only that, you can share your all or spesific stack tabs to your team online. By that, you or your team can monitor your error situation much better and easier.

Preview

Default(Light) Theme

Dark Theme

Installation

Install this package by running one of these following commands below

Via npm:
npm install nestjs-enlighten --save
Via yarn:
yarn add nestjs-enlighten

Usage

Constructor Options

Option Name Required Type Default
disableEnlighten false boolean false
theme false 'theme-light' - 'theme-dark' 'theme-light'

As Global Filter

import { NestEnlighten } from 'nestjs-enlighten';

async function bootstrap() {
  const app = await NestFactory.create(ApplicationModule);
  // Enables dark theme aswell
  app.useGlobalFilters(new NestEnlighten({ theme: 'theme-dark' }));
  await app.listen(3000);
}
bootstrap();

Enable/Disable for spesific endpoints

import { NestEnlighten } from 'nestjs-enlighten';

@Controller('account')
// Lets say you want to disable this module for this endpoint
@UseFilters(new NestEnlighten({ disableEnlighten: true }))
export class AccountController {

@Get('/error-test')
  throwError() {
    throw new BadRequestException('Example message of 400 exception');
  }
}

TODO

  • Tests
  • Github Actions
  • Online Stack share feature
  • Add solution suggestions on unexpected errors in /src/Services/Errors/State/index.ts

nestjs-enlighten's People

Contributors

danielkbx avatar dependabot[bot] avatar onur-ozkan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nestjs-enlighten's Issues

'statusCode' is undefined in Services/Errors/error.service.js

Hi,

I recently installed enlighten in my API and everything stopped working when an error occurs. I was wondering that something could be wrong with my API, so I installed enlighten on a newly created NestJS API and the results were the same. I couldn't fix this problem myself, so I'm here asking for your help, I'll leave the problem stack below

(node:5252) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'statusCode' of undefined
    at ErrorService.errorDeterminator (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/nestjs-enlighten/dist/Services/Errors/error.service.js:10:55)
    at ViewCompilerService.getCompiledView (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/nestjs-enlighten/dist/Services/ViewCompiler/view-compiler.service.js:16:78)
    at ExceptionFilter.catch (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/nestjs-enlighten/dist/Filters/exception.filter.js:31:77)
    at ExceptionsHandler.invokeCustomFilters (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/@nestjs/core/exceptions/exceptions-handler.js:33:26)
    at ExceptionsHandler.next (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/@nestjs/core/exceptions/exceptions-handler.js:13:18)
    at /home/mokyunnetwork/Gitlab/nestjs-api/node_modules/@nestjs/core/router/router-proxy.js:24:35
    at Layer.handle_error (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/express/lib/router/layer.js:71:5)
    at trim_prefix (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/express/lib/router/index.js:315:13)
    at /home/mokyunnetwork/Gitlab/nestjs-api/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/mokyunnetwork/Gitlab/nestjs-api/node_modules/express/lib/router/index.js:335:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:5252) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:5252) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Node version: v14.4.0
NestJS version: 7.4.1
Enlighten version: 0.0.4-beta

Blank screen with console errors

Hi ๐Ÿ‘‹ I was trying to test out this package, but I ran into these console errors:

image

I copied and pasted from the readme, ran npm run start:dev, and added throw new Error('sanity') in my code. Iโ€™m running "@nestjs/common": "^7.0.0", and "nestjs-enlighten": "0.0.5-beta".

I really like the idea though, would love to see it working ๐Ÿ˜„ maybe I missed a step or something

UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'internal/process/task_queues.js'

When installing and enabling enlighten using the information in the readme, I get this on the console:

(node:29011) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'internal/process/task_queues.js' at Object.openSync (fs.js:465:3) at Object.readFileSync (fs.js:368:35) at /Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:18:20 at Array.map (<anonymous>) at StackResolverService.getProperErrorStack (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:16:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at ViewCompilerService.getCompiledView (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/ViewCompiler/view-compiler.service.ts:23:36) at emitUnhandledRejectionWarning (internal/process/promises.js:168:15) at processPromiseRejections (internal/process/promises.js:247:11) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:29011) Error: ENOENT: no such file or directory, open 'internal/process/task_queues.js' at Object.openSync (fs.js:465:3) at Object.readFileSync (fs.js:368:35) at /Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:18:20 at Array.map (<anonymous>) at StackResolverService.getProperErrorStack (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:16:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at ViewCompilerService.getCompiledView (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/ViewCompiler/view-compiler.service.ts:23:36) (node:29011) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. at emitDeprecationWarning (internal/process/promises.js:180:11) at processPromiseRejections (internal/process/promises.js:249:13) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:29011) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received null at Object.openSync (fs.js:457:10) at Object.readFileSync (fs.js:368:35) at /Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:18:20 at Array.map (<anonymous>) at StackResolverService.getProperErrorStack (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:16:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at ViewCompilerService.getCompiledView (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/ViewCompiler/view-compiler.service.ts:23:36) at emitUnhandledRejectionWarning (internal/process/promises.js:168:15) at processPromiseRejections (internal/process/promises.js:247:11) at processTicksAndRejections (internal/process/task_queues.js:94:32) (node:29011) TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received null at Object.openSync (fs.js:457:10) at Object.readFileSync (fs.js:368:35) at /Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:18:20 at Array.map (<anonymous>) at StackResolverService.getProperErrorStack (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/Resolver/stack-resolver.ts:16:20) at processTicksAndRejections (internal/process/task_queues.js:93:5) at ViewCompilerService.getCompiledView (/Users/yyy/Projekte/xxx/backend/node_modules/nestjs-enlighten/src/Services/ViewCompiler/view-compiler.service.ts:23:36)

Besides this, it seems that the stack displayed on the error page is wrong - or not complete at least.

npm install does not install dist directory

When installing 0.0.7-beta, the dist folder is missing in the package. Therefore, the module does not work.
When installing the previous version (npm install [email protected]), everything is fine.

Probably, there is something wrong with the build process.

I hope, I did not break something with my PR from yesterday.

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.