Skip to content

Commit 3e26230

Browse files
committed
Fix error boxes from server-side silenced errors
1 parent 46ab50d commit 3e26230

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

frontend/composables/useErrorBoxes.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export default function useErrorBoxes() {
2121
},
2222

2323
handleError(error: unknown) {
24+
// Client-side listeners stop silenced errors from getting this far, but
25+
// unfortunately there's currently nothing to stop them server-side.
26+
if (import.meta.server && isSilenced(error)) {
27+
return;
28+
}
29+
2430
if (error instanceof FetchError && error.response) {
2531
errorBoxes.open({
2632
message: error.response.status + " " + error.response.statusText,

frontend/utils/silence.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function silence<T extends WeakKey>(error: T): T {
99
}
1010

1111
/** Checks if {@link silence} was ever called on an error. */
12-
function isSilenced(error: unknown): boolean {
12+
export function isSilenced(error: unknown): boolean {
1313
// @ts-expect-error `WeakSet.prototype.has` already returns `false` for
1414
// incorrect types, which is the desired behavior.
1515
return silencedErrors.has(error);

0 commit comments

Comments
 (0)