 <p>That is not the intended use of exceptions and is bad practice. Exceptions are intended for those conditions that are not forseable and/or outside of the control of the current developer. </p> <p>In your case you can predict that some users will not be 'test' users, otherwise why have the test. What you are doing here is to use an exception just to return an alternative message that you then echo. So you do not need to throw an exception, simply return an alternative message that indicates this.</p>