mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
Finished MessageRepository
+ Tests
This commit is contained in:
@@ -91,11 +91,11 @@ public class UsersRepository : IUsersRepository
|
||||
}
|
||||
catch (InvalidObjectException<User> ex)
|
||||
{
|
||||
throw new AdditionUserException("User with given data invalid", ex);
|
||||
throw new AdditionException("User with given data invalid", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new AdditionUserException("Cannot add user", ex);
|
||||
throw new AdditionException("Cannot add user", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,11 +122,11 @@ public class UsersRepository : IUsersRepository
|
||||
}
|
||||
catch (NotFoundByKeyException<Guid> ex)
|
||||
{
|
||||
throw new UserUpdateException($"Not found user by given id {user.Id}", ex);
|
||||
throw new UpdateException($"Not found user by given id {user.Id}", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new UserUpdateException($"Error when updating the user {user.Id}", ex);
|
||||
throw new UpdateException($"Error when updating the user {user.Id}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class UsersRepository : IUsersRepository
|
||||
}
|
||||
catch (InvalidObjectException<User> ex)
|
||||
{
|
||||
throw new UserRemoveException("User with given data invalid", ex);
|
||||
throw new RemoveException("User with given data invalid", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,11 +154,11 @@ public class UsersRepository : IUsersRepository
|
||||
}
|
||||
catch (NotFoundByKeyException<Guid> ex)
|
||||
{
|
||||
throw new UserRemoveException($"Not found user by given id {userId}", ex);
|
||||
throw new RemoveException($"Not found user by given id {userId}", ex);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new UserRemoveException("Error when removing the user", ex);
|
||||
throw new RemoveException("Error when removing the user", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,14 +183,4 @@ public class UsersRepository : IUsersRepository
|
||||
return _context.Users.AnyAsync(u => u.Username == username);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class UserRemoveException(string s, Exception exception)
|
||||
: Exception(s, exception);
|
||||
|
||||
public class AdditionUserException(string s, Exception ex)
|
||||
: Exception(s, ex);
|
||||
|
||||
public class UserUpdateException(string s, Exception ex)
|
||||
: Exception(s, ex);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user