1.0.2 • Published 6 years ago
tierra v1.0.2
tierra
automatically create client-friendly aliases for errors
e.g
new Error("hello") --> QaOS3mKU
Setup
npm i --save tierraIt 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.