GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - unlight/errorlings: Custom errors

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.editorconfig
.editorconfig
 
 
.eslintrc.js
.eslintrc.js
 
 
.gitignore
.gitignore
 
 
.npmignore
.npmignore
 
 
.nycrc.json
.nycrc.json
 
 
.releaserc.json
.releaserc.json
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
Taskfile
Taskfile
 
 
index.ts
index.ts
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 
tslint.json
tslint.json
 
 

Repository files navigation

errorlings

Common errors for your application.

API

Create error (all parameters optional and can be passed in any order)

const e = new CustomEror(status: number, message: string, code: string, inner: Error, { data: any });

Rules of detecting type of parameter:

  • typeof number: status
  • first string: message
  • second string: code
  • instanceof Error: inner
  • object with key data: data

Using options object as parameter:

const err = new CustomEror({
    status?: number;
    data?: any;
    code?: string;
    inner?: Error;
    message?: string;
});

Error classes and defaults

  • ExceptionError
  • ForbiddenError (status: 403, message: You don't have permission to do that.)
  • NotFoundError (status: 404)
  • ValidationError (status: 400)

Changelog

See CHANGELOG.md

Similar Projects

  • https://github.com/shutterstock/node-common-errors

About

Custom errors

Topics

custom-errors

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.