Skip to content
This repository was archived by the owner on Feb 4, 2018. It is now read-only.

Commit 541e940

Browse files
author
blond
committed
fix(EntityTypeError): support not object values
1 parent 9f14332 commit 541e940

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/entity-type-error.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ const ExtendableError = require('es6-error');
99
*/
1010
module.exports = class EntityTypeError extends ExtendableError {
1111
/**
12-
* @param {object} obj — not valid object
12+
* @param {*} obj — not valid object
1313
* @param {string} [reason] — human-readable reason why object is not valid
1414
*/
1515
constructor(obj, reason) {
1616
const str = util.inspect(obj, { depth: 1 });
17-
const message = `the object \`${str}\` is not valid BEM entity`;
17+
const type = obj ? typeof obj : '';
18+
const message = `the ${type} \`${str}\` is not valid BEM entity`;
1819

1920
super(reason ? `${message}, ${reason}` : message);
2021
}

0 commit comments

Comments
 (0)