feat(BitField): add problematic bit to error (#4617)

This commit is contained in:
Souji
2020-08-12 12:37:01 +02:00
committed by GitHub
parent 2a7f749d5a
commit 0225851e40

View File

@@ -147,7 +147,9 @@ class BitField {
if (bit instanceof BitField) return bit.bitfield;
if (Array.isArray(bit)) return bit.map(p => this.resolve(p)).reduce((prev, p) => prev | p, 0);
if (typeof bit === 'string' && typeof this.FLAGS[bit] !== 'undefined') return this.FLAGS[bit];
throw new RangeError('BITFIELD_INVALID');
const error = new RangeError('BITFIELD_INVALID');
error.bit = bit;
throw error;
}
}