Skip to content

Commit

Permalink
fix(PS5): Prevent uncaught promise rejections when requests are abort…
Browse files Browse the repository at this point in the history
…ed (#7637)

On PS5 we are seeing following uncaught exceptions when requests are
aborted:
```
[Error] Fetch is aborted – PromiseRejectionEvent {isTrusted: false, promise: Promise, reason: AbortError: Fetch is aborted, …}
PromiseRejectionEvent {isTrusted: false, promise: Promise, reason: AbortError: Fetch is aborted, type: "unhandledrejection", target: Window, …}PromiseRejectionEvent
	(anonymous function) (Anonymous Script 1 (line 429))
[Error] Unhandled Promise Rejection: AbortError: Fetch is aborted
	promiseEmptyOnRejected
	promiseReactionJob
```
  • Loading branch information
tykus160 authored Nov 20, 2024
1 parent d7e78f6 commit 09cfac2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/util/abortable_operation.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ shaka.util.AbortableOperation = class {
*/
chain(onSuccess, onError) {
const newPromise = new shaka.util.PublicPromise();
// Silence uncaught rejection errors, which may otherwise occur any place
// we don't explicitly handle aborted operations.
newPromise.catch(() => {});
const abortError = shaka.util.AbortableOperation.abortError();

// If called before "this" completes, just abort "this".
Expand Down

0 comments on commit 09cfac2

Please sign in to comment.