aboutsummaryrefslogtreecommitdiff
path: root/src/utils/error-msg.ts
blob: 732577690086b0ce8c4acc392a354925e97cab6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
export default (error?: string | Error): string => {
  let str = '🚫 unknown error';

  if (error) {
    if (typeof error === 'string') {
      str = `🚫 ${error}`;
    } else if (error instanceof Error) {
      str = `🚫 error: ${error.name}`;
    }
  }

  return str;
};