Name the DatabaseError so we get better logs

This commit is contained in:
Johannes Zellner
2016-08-05 12:30:28 +02:00
parent ed734ef2ae
commit 26a590b827
2 changed files with 3 additions and 2 deletions

View File

@@ -9,11 +9,12 @@ var assert = require('assert'),
function DatabaseError(reason, errorOrMessage) {
assert.strictEqual(typeof reason, 'string');
assert(errorOrMessage instanceof Error || typeof errorOrMessage === 'string' || typeof errorOrMessage === 'undefined' || errorOrMessage === null);
assert(errorOrMessage instanceof Error || typeof errorOrMessage === 'string' || typeof errorOrMessage === 'undefined');
Error.call(this);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.reason = reason;
if (typeof errorOrMessage === 'undefined' || errorOrMessage === null) {
this.message = reason;