diff --git a/lib/error.js b/lib/error.js index 869cc2e1..c36d5e58 100644 --- a/lib/error.js +++ b/lib/error.js @@ -407,7 +407,7 @@ function LibrdKafkaError(e) { this.origin = 'kafka'; } Error.captureStackTrace(this, this.constructor); - } else if (!util.isError(e)) { + } else if (!(e instanceof Error || Object.prototype.toString.call(e) === '[object Error]')) { // This is the better way this.message = e.message; this.code = e.code;