@hypercolor/http-errors
v0.0.1
Published
Custom HTTP Error Class used by the team at Hypercolor to provide consistent HTTP Error formatting between services for a given project.
Downloads
1
Readme
Hypercolor HTTP Errors
Table of Contents
Introduction
This tool is used by the team at Hypercolor to provide consistent HTTP Error formatting between services for a given project.
Installation
- NPM
npm i @hypercolor/http-errors
- Yarn
yarn add @hypercolor/http-errors
Usage
Example:
import { NotFoundError } from '@hypercolor/http-errors';
export class Service {
public async findSomething(id: number) {
const found = await this.findSomething(id);
if (!found) {
throw new NotFoundError('Something not found with ID: ' + id);
}
return found;
}
}