update database error messages
This commit is contained in:
parent
f89483f878
commit
f245ff74a8
72 changed files with 325 additions and 441 deletions
|
@ -1,6 +1,7 @@
|
|||
import { dataSource } from "../../data-source";
|
||||
import { role } from "../../entity/user/role";
|
||||
import { user } from "../../entity/user/user";
|
||||
import DatabaseActionException from "../../exceptions/databaseActionException";
|
||||
import InternalException from "../../exceptions/internalException";
|
||||
|
||||
export default abstract class UserService {
|
||||
|
@ -22,7 +23,7 @@ export default abstract class UserService {
|
|||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("users not found", err);
|
||||
throw new DatabaseActionException("SELECT", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,7 +45,7 @@ export default abstract class UserService {
|
|||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("user not found by id", err);
|
||||
throw new DatabaseActionException("SELECT", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -64,7 +65,7 @@ export default abstract class UserService {
|
|||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("user not found by username", err);
|
||||
throw new DatabaseActionException("SELECT", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -86,7 +87,7 @@ export default abstract class UserService {
|
|||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("user not found by mail or username", err);
|
||||
throw new DatabaseActionException("SELECT", "user", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@ export default abstract class UserService {
|
|||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("could not count users", err);
|
||||
throw new DatabaseActionException("COUNT", "users", err);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -125,7 +126,7 @@ export default abstract class UserService {
|
|||
return res.roles;
|
||||
})
|
||||
.catch((err) => {
|
||||
throw new InternalException("could not get roles for user", err);
|
||||
throw new DatabaseActionException("SELECT", "userRoles", err);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue