mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-06-09 15:07:51 +00:00
fix: replace throw error with axios error handling in SalesOrderService and MarketingExportService
All catch blocks in singleApproval, bulkApprovals (both classes), and delivery now return error.response?.data for axios errors and undefined otherwise, consistent with the BaseApiService pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -45,8 +45,11 @@ export class SalesOrderService extends BaseApiService<
|
||||
notes: notes || `${action} marketing ${id}`,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} catch (error: unknown) {
|
||||
if (axios.isAxiosError<BaseApiResponse<{ message: string }>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +71,11 @@ export class SalesOrderService extends BaseApiService<
|
||||
notes: notes || `${action} marketing ${ids.join(', ')}`,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} catch (error: unknown) {
|
||||
if (axios.isAxiosError<BaseApiResponse<{ message: string }>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +116,11 @@ export class SalesOrderService extends BaseApiService<
|
||||
notes: notes || `Delivery marketing ${id}`,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} catch (error: unknown) {
|
||||
if (axios.isAxiosError<BaseApiResponse<{ message: string }>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -142,8 +151,11 @@ class MarketingExportService extends BaseApiService<
|
||||
notes: notes,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw error;
|
||||
} catch (error: unknown) {
|
||||
if (axios.isAxiosError<BaseApiResponse<Marketing[] | Marketing>>(error)) {
|
||||
return error.response?.data;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user