aboutsummaryrefslogtreecommitdiff
path: root/src/utils/error-msg.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/error-msg.ts')
-rw-r--r--src/utils/error-msg.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/utils/error-msg.ts b/src/utils/error-msg.ts
new file mode 100644
index 0000000..7325776
--- /dev/null
+++ b/src/utils/error-msg.ts
@@ -0,0 +1,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;
+};