better error handing

This commit is contained in:
ArnoChen 2025-02-10 23:44:44 +08:00
parent 7d6ffbbd87
commit beee79d013
2 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,7 @@ export const checkHealth = async (): Promise<
} catch (e) { } catch (e) {
return { return {
status: 'error', status: 'error',
message: `${e}` message: e instanceof Error ? e.message : `${e}`
} }
} }
} }

View File

@ -53,7 +53,9 @@ const fetchGraph = async (label: string) => {
try { try {
rawData = await queryGraphs(label) rawData = await queryGraphs(label)
} catch (e) { } catch (e) {
useBackendState.getState().setErrorMessage(`${e}`, 'Query Graphs Error!') useBackendState
.getState()
.setErrorMessage(e instanceof Error ? e.message : `${e}`, 'Query Graphs Error!')
return null return null
} }