Catch and callback with errors correctly