Skip to content

Commit 1bca7eb

Browse files
author
serhii.zahuba
committed
fix func
1 parent 0deef18 commit 1bca7eb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

frontend/src/features/sqlquery/SqlQueryComponent.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,19 @@ export const SqlQueryComponent = ({ databaseId }: Props) => {
9494
});
9595
setResp(r);
9696
} catch (e: unknown) {
97-
setErrorText(friendlyError(e?.message || 'Unexpected error'));
97+
let msg = 'Unexpected error';
98+
if (e instanceof Error) {
99+
msg = e.message;
100+
} else if (typeof e === 'string') {
101+
msg = e;
102+
} else {
103+
try {
104+
msg = JSON.stringify(e);
105+
} catch {
106+
/* ignore */
107+
}
108+
}
109+
setErrorText(friendlyError(msg));
98110
} finally {
99111
setLoading(false);
100112
}

0 commit comments

Comments
 (0)