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));
|
this._loggingMessager.publish('user.create.info', JSON.stringify(user));
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
let key = 'user.create.crit';
|
||||||
|
if (error.message.includes('Already exists')) {
|
||||||
|
key = 'user.create.warning';
|
||||||
|
}
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.create.critical',
|
key,
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|
|
@ -18,13 +18,13 @@ export class DeleteUserUseCase {
|
||||||
const user = await this._repository.delete(command.uuid);
|
const user = await this._repository.delete(command.uuid);
|
||||||
this._userMessager.publish('delete', JSON.stringify({ uuid: user.uuid }));
|
this._userMessager.publish('delete', JSON.stringify({ uuid: user.uuid }));
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'delete',
|
'user.delete.info',
|
||||||
JSON.stringify({ uuid: user.uuid }),
|
JSON.stringify({ uuid: user.uuid }),
|
||||||
);
|
);
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.delete.critical',
|
'user.delete.crit',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|
|
@ -40,7 +40,7 @@ export class UpdateUserUseCase {
|
||||||
return user;
|
return user;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this._loggingMessager.publish(
|
this._loggingMessager.publish(
|
||||||
'user.update.critical',
|
'user.update.crit',
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
command,
|
command,
|
||||||
error,
|
error,
|
||||||
|
|
Loading…
Reference in New Issue