There is a function very similar to the last version and you can see a very clear example in the Managing errors section.