fix(datasource): improve error handling and user feedback in DataSource components

- Updated error handling in DataSourceSettings and DataSourceEditorDialog to provide more informative messages.
- Enhanced the UI to display error details more clearly, improving user experience during connection tests and resource loading.
- Adjusted HTTP response status checks in request utility for better accuracy in handling success responses.
This commit is contained in:
wizardchen
2026-03-30 15:08:57 +08:00
committed by lyingbug
parent 8021647929
commit 36dac0120a
4 changed files with 82 additions and 24 deletions
@@ -67,8 +67,8 @@ function handleDelete(ds: DataSource) {
MessagePlugin.success(t('datasource.deleteSuccess'))
await loadList()
confirmDialog.hide()
} catch {
MessagePlugin.error(t('datasource.deleteFailed'))
} catch (e: any) {
MessagePlugin.error(e?.message || e?.error || t('datasource.deleteFailed'))
}
},
})
@@ -79,8 +79,8 @@ async function handleSync(ds: DataSource) {
await triggerSync(ds.id)
MessagePlugin.success(t('datasource.syncTriggered'))
loadList()
} catch {
MessagePlugin.error(t('datasource.syncFailed'))
} catch (e: any) {
MessagePlugin.error(e?.message || e?.error || t('datasource.syncFailed'))
}
}
@@ -89,8 +89,8 @@ async function handlePause(ds: DataSource) {
await pauseDataSource(ds.id)
MessagePlugin.success(t('datasource.paused'))
loadList()
} catch {
MessagePlugin.error(t('datasource.pauseFailed'))
} catch (e: any) {
MessagePlugin.error(e?.message || e?.error || t('datasource.pauseFailed'))
}
}
@@ -99,8 +99,8 @@ async function handleResume(ds: DataSource) {
await resumeDataSource(ds.id)
MessagePlugin.success(t('datasource.resumed'))
loadList()
} catch {
MessagePlugin.error(t('datasource.resumeFailed'))
} catch (e: any) {
MessagePlugin.error(e?.message || e?.error || t('datasource.resumeFailed'))
}
}