Skip to content

Commit 9db4d1d

Browse files
authored
Fix error message handling in getusermedia/gum. (#1664)
* Fix error message handling in getusermedia/gum. Currently, when some errors occur in the getusermedia/gum demo, the error message isn't handled correctly because the constraints object might not have required properties in some cases. This patch fixes the error message handling by using the error object directly and dumping it as a JSON string.
1 parent fba7dc3 commit 9db4d1d

File tree

1 file changed

+2
-3
lines changed
  • src/content/getusermedia/gum/js

1 file changed

+2
-3
lines changed

src/content/getusermedia/gum/js/main.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ function handleSuccess(stream) {
2424

2525
function handleError(error) {
2626
if (error.name === 'OverconstrainedError') {
27-
const v = constraints.video;
28-
errorMsg(`The resolution ${v.width.exact}x${v.height.exact} px is not supported by your device.`);
27+
errorMsg(`OverconstrainedError: The constraints could not be satisfied by the available devices. Constraints: ${JSON.stringify(constraints)}`);
2928
} else if (error.name === 'NotAllowedError') {
30-
errorMsg('Permissions have not been granted to use your camera and ' +
29+
errorMsg('NotAllowedError: Permissions have not been granted to use your camera and ' +
3130
'microphone, you need to allow the page access to your devices in ' +
3231
'order for the demo to work.');
3332
}

0 commit comments

Comments
 (0)