Skip to content

hypercolor/http-errors

Repository files navigation

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

More Information

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published