fix: show clear error message when MarkBase needs restart (PostgreSQL→SQLite migration)
- Detects 'missing field postgresql' error from MarkBase config endpoint - Shows user-friendly message: 'MarkBase needs restart (PostgreSQL→SQLite migration)' - Helps users understand the error is due to outdated MarkBase instance
This commit is contained in:
@@ -1038,9 +1038,13 @@ async function loadSettings() {
|
||||
try {
|
||||
const resp = await fetch(`${markbaseUrl.value}/api/v2/config`)
|
||||
if (!resp.ok) {
|
||||
// MarkBase config may return 500 if config file is incomplete
|
||||
const errData = await resp.json().catch(() => null)
|
||||
throw new Error(`HTTP ${resp.status}: ${errData?.error || resp.statusText}`)
|
||||
const errMsg = errData?.error || resp.statusText || ''
|
||||
// MarkBase config may return 500 if still running old version requiring postgresql
|
||||
if (errMsg.includes('postgresql')) {
|
||||
throw new Error('MarkBase needs restart (PostgreSQL→SQLite migration)')
|
||||
}
|
||||
throw new Error(`HTTP ${resp.status}: ${errMsg}`)
|
||||
}
|
||||
const cfg = await resp.json()
|
||||
uploadPath.value = cfg.server?.upload_path || ''
|
||||
|
||||
Reference in New Issue
Block a user