1.0.2 • Published 5 years ago

tierra v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

tierra

automatically create client-friendly aliases for errors

e.g

new Error("hello") --> QaOS3mKU

Setup

npm i --save tierra

It is recommended to create a singleton object to keep errors consistent and centralized across the codebase.

// ES5
const Tierra = require("tierra").default;

// ES6
import Tierra from "tierra";

const tierra = Tierra(/*seed*/);

The Tierra() function accepts an optional seed argument for code generation.

Usage

Tierra is kept simple and only has two methods.

Return alias for an error:

tierra.get(new Error("Some error"));
// 'h10j2WGO'

Return table of aliases and values

tierra.table();
// { h10j2WGO: 'Error: Some error' }

By remaining simple, Tierra is unopinionated and lightweight.

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago