Skip to content

Commit 904e750

Browse files
committed
fix: improve error handling in ConfigProfileService
1 parent 20f075e commit 904e750

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/modules/config-profiles/config-profile.service.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ export class ConfigProfileService {
256256

257257
return this.getConfigProfileByUUID(existingConfigProfile.uuid);
258258
} catch (error) {
259+
this.logger.error(error);
260+
259261
if (
260262
error instanceof PrismaClientKnownRequestError &&
261263
error.code === 'P2002' &&
@@ -271,7 +273,14 @@ export class ConfigProfileService {
271273
return { isOk: false, ...ERRORS.CONFIG_PROFILE_NAME_ALREADY_EXISTS };
272274
}
273275
}
274-
this.logger.error(error);
276+
277+
if (error instanceof Error) {
278+
return {
279+
isOk: false,
280+
...ERRORS.CONFIG_VALIDATION_ERROR.withMessage(error.message),
281+
};
282+
}
283+
275284
return {
276285
isOk: false,
277286
...ERRORS.UPDATE_CONFIG_PROFILE_ERROR,

0 commit comments

Comments
 (0)