aboutsummaryrefslogtreecommitdiff
path: root/src/utils/error-msg.ts
blob: ef03e76ec9f557b535ba8d6671aeb9f827ebf347 (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 = `🚫ope: ${error}`;
    } else if (error instanceof Error) {
      str = `🚫ope: ${error.message}`;
    }
  }

  return str;
};