Skip to content

Commit b568ad3

Browse files
committed
put back the catch
1 parent bb8c8b4 commit b568ad3

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

packages/svelte/src/internal/client/dom/elements/transitions.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -404,13 +404,25 @@ function animate(element, options, counterpart, t2, on_finish, on_abort) {
404404
fill: 'forwards'
405405
});
406406

407-
animation.finished.then(() => {
408-
on_finish?.();
409-
410-
if (t2 === 1) {
411-
animation.cancel();
412-
}
413-
});
407+
animation.finished
408+
.then(() => {
409+
on_finish?.();
410+
411+
if (t2 === 1) {
412+
animation.cancel();
413+
}
414+
})
415+
.catch((e) => {
416+
// Error for DOMException: The user aborted a request. This results in two things:
417+
// - startTime is `null`
418+
// - currentTime is `null`
419+
// We can't use the existence of an AbortError as this error and error code is shared
420+
// with other Web APIs such as fetch().
421+
422+
if (animation.startTime !== null && animation.currentTime !== null) {
423+
throw e;
424+
}
425+
});
414426
});
415427
} else {
416428
// Timer

0 commit comments

Comments
 (0)