1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/lib/customError.js
Ruben Bridgewater a857829a36 Improve error handling
Arguments are now passed to an command error in case they exist
An error is only emitted if that very same error is not already handled in a callback
2016-04-29 04:10:23 +02:00

17 lines
394 B
JavaScript

'use strict';
var util = require('util');
function CommandError (error) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = error.message;
for (var keys = Object.keys(error), key = keys.pop(); key; key = keys.pop()) {
this[key] = error[key];
}
}
util.inherits(CommandError, Error);
module.exports = CommandError;