0.0.1 • Published 1 year ago

@hypercolor/http-errors v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

Project Repository

Organization Repository