Catch error and pass to callback