ux: return clear BitMidi outage message and handoff notes

This commit is contained in:
b1rdmania
2026-02-02 23:39:29 +00:00
parent 5e81227907
commit 686c961fb3
6 changed files with 90 additions and 13 deletions
+11 -2
View File
@@ -78,7 +78,16 @@ export class MIDIService {
async search(query: string): Promise<MIDISearchResult[]> {
const response = await this.fetchWithRetry(`${this.baseUrl}/api/midi/search?q=${encodeURIComponent(query)}`);
if (!response.ok) throw new Error(`Search failed: ${response.status}`);
if (!response.ok) {
let message = `Search failed: ${response.status}`;
try {
const body = await response.json() as { error?: string };
if (body?.error) message = body.error;
} catch {
// ignore JSON parse errors and keep generic message
}
throw new Error(message);
}
const data: MIDISearchResponse = await response.json();
return data.results;
}
@@ -121,4 +130,4 @@ export class MIDIService {
return false;
}
}
}
}