mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update fetchAndUpdateRouteDataForSystemId to include try/catch
This commit is contained in:
@@ -71,6 +71,8 @@ export class ApiBasedRepositoryLoader {
|
|||||||
formData.set("json", JSON.stringify(formDataJsonObject));
|
formData.set("json", JSON.stringify(formDataJsonObject));
|
||||||
|
|
||||||
const query = new URLSearchParams(params).toString();
|
const query = new URLSearchParams(params).toString();
|
||||||
|
|
||||||
|
try {
|
||||||
const response = await fetch(`${this.baseUrl}?${query}`, {
|
const response = await fetch(`${this.baseUrl}?${query}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData,
|
body: formData,
|
||||||
@@ -90,6 +92,10 @@ export class ApiBasedRepositoryLoader {
|
|||||||
await this.repository.addOrUpdateRoute(constructedRoute);
|
await this.repository.addOrUpdateRoute(constructedRoute);
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
} catch(e: any) {
|
||||||
|
console.error(`fetchAndUpdateRouteDataForSystemId failed for system ID ${systemId}: ${e}`);
|
||||||
|
throw new ApiResponseError(e.message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async fetchAndUpdateStopAndPolylineDataForRoutesInExistingSystems() {
|
public async fetchAndUpdateStopAndPolylineDataForRoutesInExistingSystems() {
|
||||||
|
|||||||
Reference in New Issue
Block a user