Skip to content

Commit 47e7aff

Browse files
author
Grace Chong
committed
refactor: change parameter name for clarity and use chai asserts for readability
1 parent ad2c4a5 commit 47e7aff

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/error.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @public */
22
export class BSONError extends Error {
3-
constructor(m: string) {
4-
super(m);
3+
constructor(message: string) {
4+
super(message);
55
Object.setPrototypeOf(this, BSONError.prototype);
66
}
77

@@ -12,8 +12,8 @@ export class BSONError extends Error {
1212

1313
/** @public */
1414
export class BSONTypeError extends TypeError {
15-
constructor(m: string) {
16-
super(m);
15+
constructor(message: string) {
16+
super(message);
1717
Object.setPrototypeOf(this, BSONTypeError.prototype);
1818
}
1919

test/node/error_test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ describe('BSON error tests', function () {
99
const bsonTypeErr = new BSONTypeError();
1010
const bsonErr = new BSONError();
1111

12-
expect(bsonTypeErr instanceof BSONTypeError).to.be.true;
13-
expect(bsonErr instanceof BSONError).to.be.true;
12+
expect(bsonTypeErr).to.be.instanceOf(BSONTypeError);
13+
expect(bsonTypeErr).to.be.instanceOf(TypeError);
14+
expect(bsonErr).to.be.instanceOf(BSONError);
15+
expect(bsonErr).to.be.instanceOf(Error);
1416
});
1517

1618
it('should correctly get correct names for BSONTypeError and BSONError', function () {

0 commit comments

Comments
 (0)