aboutsummaryrefslogtreecommitdiff
path: root/src/utils/error-msg.ts
blob: 832de3cfc9d38e7c05fcd097afe1fde4576dfd6a (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 = `🚫 ope: ${error.name}`;
    }
  }

  return str;
};