Skip to content

Commit

Permalink
fix: return error message if error is a string
Browse files Browse the repository at this point in the history
  • Loading branch information
aalemayhu committed Jul 22, 2023
1 parent 06448b7 commit d98a31a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/errors/helpers/getErrorMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export const getErrorMessage = (error: unknown): string => {
let msg = 'Unknown error';
if (error instanceof Error) {
msg = `<h1 class='title is-4'>${error.message}</h1>`;
} else if (typeof error === 'string') {
return error;
}
return msg;
};

0 comments on commit d98a31a

Please sign in to comment.