FIX: try catch in customer controller

This commit is contained in:
marcos-silva-rodrigues
2025-01-06 14:15:29 -03:00
parent 3a6054c1c6
commit 8c12291096
2 changed files with 24 additions and 21 deletions
+14 -2
View File
@@ -59,9 +59,21 @@ export class CustomersController {
this.logger.info('saveCustomertheme', JSON.stringify({
id, theme: data
}));
const theme = await this.customersService.createThemeByCustomer(id, data);
return theme;
try {
// const theme = await this.customersService.createThemeByCustomer(id, data);
this.logger.info('saveCustomertheme', JSON.stringify(data));
return { theme: null };
} catch (err) {
if (err.details === ErrorCodes.CUSTOMER.NOT_FOUND) {
this.logger.error('Error - saveCustomertheme - Expect CUSTOMER.NOT_FOUND');
throw new HttpException(err.details, HttpStatus.NOT_FOUND);
} else {
this.logger.error('Error - saveCustomertheme Unknown Error:' + err?.message);
return { theme: null };
};
}
}
@Get(':id/theme')