mirror of
https://gitlab.com/mobicoop/v3/service/user.git
synced 2026-01-11 01:02:40 +00:00
fix logging
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user