Added simple error handling to show a error dialog when a exception occours.