forked from ddrilling/AsbCloudServer
8543610 Add exceptions for badRequest
This commit is contained in:
parent
dbbd4d5603
commit
707b8f8b3b
@ -101,7 +101,8 @@ namespace AsbCloudInfrastructure.Repository
|
||||
|
||||
var oldUser = (await GetCacheUserAsync(token)).FirstOrDefault(u => u.Id == dto.Id);
|
||||
if (oldUser is null)
|
||||
return 0;
|
||||
throw new ArgumentInvalidException
|
||||
($"Invalid id {dto.Id}. You can't edit this user.", nameof(dto));
|
||||
|
||||
if (oldUser.Login != dto.Login)
|
||||
await AssertLoginIsBusyAsync(dto.Login, token);
|
||||
@ -132,7 +133,8 @@ namespace AsbCloudInfrastructure.Repository
|
||||
{
|
||||
var user = (await GetCacheUserAsync(token)).FirstOrDefault(u => u.Id == id);
|
||||
if (user is null)
|
||||
return 0;
|
||||
throw new ArgumentInvalidException
|
||||
($"Invalid id {id}. You can't edit this user.", nameof(id));
|
||||
var query = dbContext
|
||||
.Users
|
||||
.Where(u => u.Id == id);
|
||||
|
Loading…
Reference in New Issue
Block a user