Example of how to handle exceptions together with promises.