Refactor error handling in API services to use console.error instead of throwing errors
- Updated various API service files to replace error throwing with console.error for better logging. - This change affects services related to aisles, assets, cameras, collaboration, comments, environment, lines, marketplace, simulation, visualization, and zones. - The modifications aim to improve error handling by logging errors to the console instead of interrupting the flow with thrown errors.
This commit is contained in:
@@ -17,7 +17,7 @@ export const upsertProductOrEventApi = async (body: any) => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to add product or event");
|
||||
console.error("Failed to add product or event");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -17,7 +17,7 @@ export const deleteEventDataApi = async (body: any) => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete event data");
|
||||
console.error("Failed to delete event data");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -17,7 +17,7 @@ export const deleteProductApi = async (body: any) => {
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to delete product data");
|
||||
console.error("Failed to delete product data");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -19,7 +19,7 @@ export const getProductApi = async (
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch product data");
|
||||
console.error("Failed to fetch product data");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -16,7 +16,7 @@ export const getAllProductsApi = async (projectId: string, versionId: string) =>
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch all products data");
|
||||
console.error("Failed to fetch all products data");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
@@ -19,7 +19,7 @@ export const renameProductApi = async (body: {
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to rename product");
|
||||
console.error("Failed to rename product");
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user