[fix] Change callback order in error handling

The callback was being called **before** the message was shown to the user.