Skip to content

Commit 7e3bcd0

Browse files
committed
fix: error ctor and assertion for error
1 parent e353a30 commit 7e3bcd0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/error.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class BSONError extends Error {
2323
return 'BSONError';
2424
}
2525

26-
constructor(message: string, options?: ErrorOptions) {
26+
constructor(message: string, options?: { cause?: unknown }) {
2727
super(message, options);
2828
}
2929

test/node/byte_utils.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ const toUTF8Tests: ByteUtilTest<'toUTF8'>[] = [
419419
name: 'should throw an error if fatal is set and string is invalid',
420420
inputs: [Buffer.from('616263f09fa4', 'hex'), 0, 7, true],
421421
expectation({ error }) {
422-
expect(error).to.be.instanceOf(BSONError);
422+
expect(error).to.match(/Invalid UTF-8 string in BSON document/i);
423423
}
424424
},
425425
{

0 commit comments

Comments
 (0)