custom.js 416 B

123456789101112
  1. 'use strict';
  2. module.exports = function (t, a) {
  3. var T = t, err = new T('My Error', 'MY_ERROR', { errno: 123 });
  4. a(err instanceof Error, true, "Instance of error");
  5. a(err.constructor, Error, "Constructor");
  6. a(err.name, 'Error', "Name");
  7. a(String(err), 'Error: My Error', "String representation");
  8. a(err.code, 'MY_ERROR', "Code");
  9. a(err.errno, 123, "Errno");
  10. a(typeof err.stack, 'string', "Stack trace");
  11. };