fix : return orginal error
This commit is contained in:
@@ -66,6 +66,12 @@ export class RestaurantService {
|
||||
);
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
// Return validation errors or other error types from external API
|
||||
if (error instanceof AxiosError && error.response?.data) {
|
||||
this.logger.error(`External API error response:`, error.response.data);
|
||||
return error.response.data;
|
||||
}
|
||||
|
||||
this.logger.error(`Error fetching restaurants: ${error instanceof Error ? error.message : "Unknown error"}`);
|
||||
throw error;
|
||||
}
|
||||
@@ -131,6 +137,12 @@ export class RestaurantService {
|
||||
);
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
// Return validation errors or other error types from external API
|
||||
if (error instanceof AxiosError && error.response?.data) {
|
||||
this.logger.error(`External API error response:`, error.response.data);
|
||||
return error.response.data;
|
||||
}
|
||||
|
||||
this.logger.error(`Error getting restaurant subscription: ${error instanceof Error ? error.message : "Unknown error"}`);
|
||||
throw error;
|
||||
}
|
||||
@@ -146,13 +158,19 @@ export class RestaurantService {
|
||||
.pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
this.logger.error("error in getting SMS count by restaurant", err);
|
||||
throw new BadRequestException("Failed to fetch SMS count data");
|
||||
return throwError(() => err);
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
} catch (error: unknown) {
|
||||
// Return validation errors or other error types from external API
|
||||
if (error instanceof AxiosError && error.response?.data) {
|
||||
this.logger.error(`External API error response:`, error.response.data);
|
||||
return error.response.data;
|
||||
}
|
||||
|
||||
this.logger.error("error in getSmsCountByRestaurant", error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user