Ah thanks for the info about final. I know about PdoException. The thing is I cannot create an exception that returns string code myself. Or do you know how? The only way seems to be that I make a wrong sql query for example so that I than get a PdoException with string code. But that seems like a bad approach.