Tools

Error tools.

Usage

var tools = require( '@stdlib/error/tools' );

tools

Namespace containing error tools.

var o = tools;
// returns {...}

The namespace contains the following:

  • database(): standard library error code database.
  • fmtprodmsgFactory( [options] ): return a function which formats an error message for production.
  • fmtprodmsg( code, ...args ): format an error message for production.
  • id2msg( id ): return an error message corresponding to a provided two-character error identifier.
  • id2pkg( id ): return the package name associated with a specified error identifier prefix.
  • msg2id( msg ): return a two-character error identifier corresponding to a provided error message.
  • pkg2id( pkg ): return the error identifier prefix associated with a specified package name.

Examples

var objectKeys = require( '@stdlib/utils/keys' );
var tools = require( '@stdlib/error/tools' );

console.log( objectKeys( tools ) );
Did you find this page helpful?