fix logging

This commit is contained in:
Gsk54 2022-12-26 15:23:53 +01:00
parent 4f050405ec
commit 1575c5a46d
3 changed files with 8 additions and 4 deletions

View File

@ -30,8 +30,12 @@ export class CreateUserUseCase {
this._loggingMessager.publish('user.create.info', JSON.stringify(user));
return user;
} catch (error) {
let key = 'user.create.crit';
if (error.message.includes('Already exists')) {
key = 'user.create.warning';
}
this._loggingMessager.publish(
'user.create.critical',
key,
JSON.stringify({
command,
error,

View File

@ -18,13 +18,13 @@ export class DeleteUserUseCase {
const user = await this._repository.delete(command.uuid);
this._userMessager.publish('delete', JSON.stringify({ uuid: user.uuid }));
this._loggingMessager.publish(
'delete',
'user.delete.info',
JSON.stringify({ uuid: user.uuid }),
);
return user;
} catch (error) {
this._loggingMessager.publish(
'user.delete.critical',
'user.delete.crit',
JSON.stringify({
command,
error,

View File

@ -40,7 +40,7 @@ export class UpdateUserUseCase {
return user;
} catch (error) {
this._loggingMessager.publish(
'user.update.critical',
'user.update.crit',
JSON.stringify({
command,
error,