Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including error2 with all npm packages installed. Try it out:

var error2 = require("error2")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

error2 v0.2.2

More expressive error constructor

More expressive error creation

For Node.js only ATM.


  Error2 = require("error2");

  Error2(name, data);
  Error2(name, message);
  Error2(name, message, data);


  typeof name     === "string"
  typeof message  === "string"
  typeof data     === "object"

data object can contain name and message properties, which will therfore be used.

Please consult test cases for more funny and informative examples of use.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free