mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
add try/catch to remaining methods
This commit is contained in:
@@ -156,6 +156,8 @@ export class ApiBasedRepositoryLoader {
|
||||
formData.set("json", JSON.stringify(formDataJsonObject));
|
||||
|
||||
const query = new URLSearchParams(params).toString();
|
||||
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}?${query}`, {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
@@ -180,7 +182,10 @@ export class ApiBasedRepositoryLoader {
|
||||
}
|
||||
|
||||
await this.repository.addOrUpdateShuttle(constructedShuttle);
|
||||
}))
|
||||
}));
|
||||
}
|
||||
} catch(e: any) {
|
||||
throw new ApiResponseError(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +212,8 @@ export class ApiBasedRepositoryLoader {
|
||||
};
|
||||
|
||||
const query = new URLSearchParams(params).toString();
|
||||
|
||||
try {
|
||||
const response = await fetch(`${this.baseUrl}?${query}`, {
|
||||
method: "GET",
|
||||
});
|
||||
@@ -228,6 +235,9 @@ export class ApiBasedRepositoryLoader {
|
||||
this.repository.addOrUpdateEta(eta);
|
||||
});
|
||||
}
|
||||
} catch(e: any) {
|
||||
throw new ApiResponseError(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
protected async updateStopDataForSystemAndApiResponse(systemId: string, json: any) {
|
||||
|
||||
Reference in New Issue
Block a user