Can't you do something to do with the try, catch and throw keywords?