mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 11:56:18 -05:00
Hiding syntax errors when API is down.
This commit is contained in:
parent
7c147747f1
commit
74a1486f0e
4 changed files with 21 additions and 7 deletions
|
|
@ -114,7 +114,10 @@ export function useEventsInterval() {
|
|||
setEvents(response['events']);
|
||||
} catch (e) {
|
||||
setEvents(null);
|
||||
console.error(e);
|
||||
// Ignore SyntaxError because they happen when the API is down.
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,10 @@ export function useTags() {
|
|||
} catch (e) {
|
||||
setTags(undefined);
|
||||
setTagNames(undefined);
|
||||
console.error(e);
|
||||
// Ignore SyntaxError because they happen when the API is down.
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,10 @@ async function apiCall(url, method, body, ms = 60_000) {
|
|||
}
|
||||
return response;
|
||||
} catch (e) {
|
||||
// Timeout, or some other exception.
|
||||
console.error(e);
|
||||
// Ignore SyntaxError because they happen when the API is down.
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
console.error(e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ import {
|
|||
getStatus,
|
||||
getVideo,
|
||||
getVideosStatistics,
|
||||
postImportConfig,
|
||||
postDumpConfig,
|
||||
postImportConfig,
|
||||
saveSettings,
|
||||
searchArchives,
|
||||
searchChannels,
|
||||
|
|
@ -705,7 +705,10 @@ export const useConfigs = () => {
|
|||
setConfigs(data['configs']);
|
||||
console.debug('fetching configs successful');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// Ignore SyntaxError because they happen when the API is down.
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
console.error(e);
|
||||
}
|
||||
setConfigs(undefined);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
|
|
@ -840,7 +843,10 @@ export const useStatus = () => {
|
|||
const s = await getStatus();
|
||||
setStatus(s);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
// Ignore SyntaxError because they happen when the API is down.
|
||||
if (!(e instanceof SyntaxError)) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue