fix logging
This commit is contained in:
parent
4f050405ec
commit
1575c5a46d
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -40,7 +40,7 @@ export class UpdateUserUseCase {
|
|||
return user;
|
||||
} catch (error) {
|
||||
this._loggingMessager.publish(
|
||||
'user.update.critical',
|
||||
'user.update.crit',
|
||||
JSON.stringify({
|
||||
command,
|
||||
error,
|
||||
|
|
Loading…
Reference in New Issue