io.js 470 B

123456789101112131415161718192021
  1. 'use strict';
  2. module.exports = IOError;
  3. function IOError(cause, prefix) {
  4. var err = new Error(prefix + ': ' + cause.message);
  5. Object.defineProperty(err, 'type', {
  6. value: 'error.IOError',
  7. configurable: true,
  8. enumerable: true
  9. });
  10. err.name = 'WrappedIOError';
  11. err.statusCode = 500;
  12. Object.defineProperty(err, 'cause', {
  13. value: cause,
  14. configurable: true,
  15. enumerable: false
  16. });
  17. return err;
  18. }