Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add error name for custom device controller error #1815

Merged
merged 1 commit into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add error name for custom device controller error.

### Removed

### Fixed

### Changed

## [2.23.0] - 2021-11-22
### Added
- Add support for Echo Reduction when using Voice Focus.
Expand Down
1 change: 1 addition & 0 deletions src/devicecontroller/GetUserMediaError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
export default class GetUserMediaError extends Error {
constructor(public cause?: Error, message?: string) {
super(message || 'Error fetching device.');
this.name = 'GetUserMediaError';
}
}
1 change: 1 addition & 0 deletions src/devicecontroller/NotFoundError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import GetUserMediaError from './GetUserMediaError';
export default class NotFoundError extends GetUserMediaError {
constructor(cause?: Error) {
super(cause);
this.name = 'NotFoundError';
}
}
1 change: 1 addition & 0 deletions src/devicecontroller/NotReadableError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import GetUserMediaError from './GetUserMediaError';
export default class NotReadableError extends GetUserMediaError {
constructor(cause?: Error) {
super(cause);
this.name = 'NotReadableError';
}
}
1 change: 1 addition & 0 deletions src/devicecontroller/OverconstrainedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import GetUserMediaError from './GetUserMediaError';
export default class OverconstrainedError extends GetUserMediaError {
constructor(cause?: Error, public constraint?: string) {
super(cause);
this.name = 'OverconstrainedError';
}
}
1 change: 1 addition & 0 deletions src/devicecontroller/PermissionDeniedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import GetUserMediaError from './GetUserMediaError';
export default class PermissionDeniedError extends GetUserMediaError {
constructor(cause?: Error, message?: string) {
super(cause, message);
this.name = 'PermissionDeniedError';
}
}
1 change: 1 addition & 0 deletions src/devicecontroller/TypeError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ import GetUserMediaError from './GetUserMediaError';
export default class TypeError extends GetUserMediaError {
constructor(cause?: Error) {
super(cause);
this.name = 'TypeError';
}
}
11 changes: 11 additions & 0 deletions test/devicecontroller/DefaultDeviceController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(NotReadableError);
expect(e.name).to.be.equal('NotReadableError');
}
});

Expand All @@ -1315,6 +1316,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(NotReadableError);
expect(e.name).to.be.equal('NotReadableError');
}
});

Expand All @@ -1327,6 +1329,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(NotFoundError);
expect(e.name).to.be.equal('NotFoundError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1340,6 +1343,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(NotFoundError);
expect(e.name).to.be.equal('NotFoundError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1353,6 +1357,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(NotReadableError);
expect(e.name).to.be.equal('NotReadableError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1366,6 +1371,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(OverconstrainedError);
expect(e.name).to.be.equal('OverconstrainedError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1379,6 +1385,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(OverconstrainedError);
expect(e.name).to.be.equal('OverconstrainedError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1392,6 +1399,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(TypeError);
expect(e.name).to.be.equal('TypeError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1405,6 +1413,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(GetUserMediaError);
expect(e.name).to.be.equal('GetUserMediaError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1417,6 +1426,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(GetUserMediaError);
expect(e.name).to.be.equal('GetUserMediaError');
expect(e.message).to.not.equal('This line should not be reached');
}
});
Expand All @@ -1429,6 +1439,7 @@ describe('DefaultDeviceController', () => {
throw new Error('This line should not be reached');
} catch (e) {
expect(e).to.be.instanceof(GetUserMediaError);
expect(e.name).to.be.equal('GetUserMediaError');
expect(e.message).to.include('Error fetching device.');
}
});
Expand Down