Skip to content

Commit

Permalink
Use uknown error parameter in toasts.ts as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsgrd committed Jul 14, 2024
1 parent 5e3d442 commit 6ef7279
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions app/src/lib/notifications/toasts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,20 @@ export function showToast(toast: Toast) {
]);
}

export function showError(title: string, error: any) {
export function showError(title: string, error: unknown) {
// Silence GitHub octokit.js when disconnected
if (error.status === 500 && error.message === 'Load failed') return;

const message = error.message || error.toString();
showToast({ title, error: message, style: 'error' });
// TODO: Fix this elsewhere.
if (error instanceof Object) {
if (
'status' in error &&
'message' in error &&
error.status === 500 &&
error.message === 'Load failed'
)
return;
const message = 'message' in error ? error.message : String(error);
showToast({ title, error: message, style: 'error' });
}
}

export function showInfo(title: string, message: string) {
Expand Down

0 comments on commit 6ef7279

Please sign in to comment.