diff --git a/BankingBot/ActionManagers/LoginManagers/LloydsLoginManager.cs b/BankingBot/ActionManagers/LoginManagers/LloydsLoginManager.cs index 7a622c5..e8d6139 100644 --- a/BankingBot/ActionManagers/LoginManagers/LloydsLoginManager.cs +++ b/BankingBot/ActionManagers/LoginManagers/LloydsLoginManager.cs @@ -9,6 +9,7 @@ using BankingBot.Responses; using BankingBot.Enums; using BankingBot.ScriptManagement; using BankingBot.Urls; +using BankingBot.Exceptions; namespace BankingBot.ActionManagers.LoginManagers { @@ -36,12 +37,12 @@ namespace BankingBot.ActionManagers.LoginManagers LoginStep1(lloydsCreds); if (!_browserBot.WebDriver.Url.Contains(LloydsUrls.MemorableInfo)) - throw new InvalidOperationException("Invalid login credentials"); + throw new InvalidCredentialsException("Invalid login credentials"); LoginStep2(lloydsCreds); if (!_browserBot.WebDriver.Url.Contains(LloydsUrls.AccountOverview)) - throw new InvalidOperationException("Invalid passphrase for account"); + throw new InvalidCredentialsException("Invalid passphrase for account"); response.Status = ResponseStatus.Success; } @@ -71,7 +72,7 @@ namespace BankingBot.ActionManagers.LoginManagers var maxPassphraseLength = passphraseIndexes[2]; if (credentials.Passphrase.Length < maxPassphraseLength) - throw new IndexOutOfRangeException("Paspshrase is too short"); + throw new InvalidCredentialsException("Passphrase is too short"); _browserBot.WebDriver.FindElement(By.Id(GetPassphraseDdlId(1))).SendKeys( credentials.Passphrase[passphraseIndexes[0]].ToString()); diff --git a/BankingBot/BankingBot.csproj b/BankingBot/BankingBot.csproj index e185e02..7ba7802 100644 --- a/BankingBot/BankingBot.csproj +++ b/BankingBot/BankingBot.csproj @@ -67,6 +67,7 @@ + diff --git a/BankingBot/Exceptions/InvalidCredentialsException.cs b/BankingBot/Exceptions/InvalidCredentialsException.cs new file mode 100644 index 0000000..59ca81d --- /dev/null +++ b/BankingBot/Exceptions/InvalidCredentialsException.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BankingBot.Exceptions +{ + public class InvalidCredentialsException : Exception + { + public InvalidCredentialsException() + { + } + + public InvalidCredentialsException(string message) + :base(message) + { + } + } +}