Use a custom exception

http://ideone.com/7Em5nl