Skip to content

Commit 964af81

Browse files
abobadalecurtis
authored andcommitted
Add more granular error messages
1 parent 8526db4 commit 964af81

File tree

1 file changed

+12
-3
lines changed
  • samples/encode-decode-worker/js

1 file changed

+12
-3
lines changed

samples/encode-decode-worker/js/main.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,18 @@ function stop() {
136136
stopButton.disabled = true;
137137
connectButton.disabled = true;
138138
streamWorker.postMessage({ type: "stop" });
139-
inputStream.cancel();
140-
outputStream.abort();
141-
addToEventLog('stop(): input stream cancelled and output stream aborted');
139+
try {
140+
inputStream.cancel();
141+
addToEventLog('inputStream cancelled');
142+
} catch(e) {
143+
addToEventLog(`Could not cancel inputStream: ${e.message}`);
144+
}
145+
try {
146+
outputStream.abort();
147+
addToEventLog('outputStream aborted');
148+
} catch(e) {
149+
addToEventLog(`Could not abort outputStream: ${e.message}`);
150+
}
142151
}
143152

144153
document.addEventListener('DOMContentLoaded', async function(event) {

0 commit comments

Comments
 (0)