Add more errors

This commit is contained in:
2025-08-20 00:14:26 +07:00
parent 7c58e1d7d2
commit 82fa0d20d2
2 changed files with 20 additions and 6 deletions

View File

@@ -56,14 +56,12 @@ public class UserService : IUserService
if (!_authorizedAddresses.Any(a => string.Equals(a, recoveredAddress, StringComparison.OrdinalIgnoreCase)))
{
_logger.LogWarning($"Address {recoveredAddress} not authorized");
throw new Exception("Address not authorized");
throw new Exception($"Address {recoveredAddress} not authorized");
}
if (recoveredAddress == null || !recoveredAddress.Equals(address))
{
_logger.LogWarning($"Address {recoveredAddress} not corresponding");
throw new Exception("Address not corresponding");
throw new Exception($"Address {recoveredAddress} not corresponding");
}
// Check if account exist
@@ -72,7 +70,7 @@ public class UserService : IUserService
if (user != null)
{
if (!user.Name.Equals(name))
throw new Exception("Name not corresponding");
throw new Exception("Name not corresponding to user " + name);
// User and account found
user.Accounts = _accountService.GetAccountsByUser(user).ToList();
@@ -82,7 +80,7 @@ public class UserService : IUserService
if (account == null)
{
throw new Exception("Account not found");
throw new Exception("Account not found for address " + recoveredAddress);
}
return user;