aboutsummaryrefslogtreecommitdiff
path: root/src/utils/error-msg.ts
blob: 0f4e0b2fa2d0fa5c8c4067fff5fe8c4390cf7daa (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.message}`;
    }
  }

  return str;
};