add error throwing to method

This commit is contained in:
2025-01-22 14:59:04 -08:00
parent acc8d562c3
commit df0e1d3d0f

View File

@@ -120,6 +120,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,
@@ -129,6 +131,10 @@ export class ApiBasedRepositoryLoader {
await this.updateStopDataForSystemAndApiResponse(systemId, json); await this.updateStopDataForSystemAndApiResponse(systemId, json);
await this.updateOrderedStopDataForExistingStops(json); await this.updateOrderedStopDataForExistingStops(json);
await this.updatePolylineDataForExistingRoutesAndApiResponse(json); await this.updatePolylineDataForExistingRoutesAndApiResponse(json);
} catch(e: any) {
console.error(`fetchAndUpdateStopAndPolylineDataForRoutesWithSystemId failed for system ID ${systemId}:`, e);
throw new ApiResponseError(e.message);
}
} }
public async fetchAndUpdateShuttleDataForExistingSystems() { public async fetchAndUpdateShuttleDataForExistingSystems() {