Soldato
- Joined
- 4 Mar 2010
- Posts
- 5,038
Hi chaps trying to implement some error checking in a couple of classes.
It's a login class with PDO instantiated inside.
Now the problem I am having is when a user logs in it will catch an error if they have left out a missing field ($user, $pass) this works; but when it catches the error it carrys on to the next private method being called in this case it's a PDO connection which checks to see if the user exists on the db then catchs another error returning "incorrect username and or password".
It's a PITA , because if a user were to leave an empty feild it will return two errors eg "Please enter your username Incorrect username and/or password". How do I keep the catching functionally without it passing both errors down the stack?
It's a login class with PDO instantiated inside.
Now the problem I am having is when a user logs in it will catch an error if they have left out a missing field ($user, $pass) this works; but when it catches the error it carrys on to the next private method being called in this case it's a PDO connection which checks to see if the user exists on the db then catchs another error returning "incorrect username and or password".
It's a PITA , because if a user were to leave an empty feild it will return two errors eg "Please enter your username Incorrect username and/or password". How do I keep the catching functionally without it passing both errors down the stack?
Last edited: