I would like to "centralize" the exception handler. For example:
// login_view.dart: the login view throws an exception
throw new LoginException("Invalid username or password");
// exception_handler.dart: in some point of my application the exception is captured
void exceptionHandler(Exception e) {
if (e is LoginException) {
showModalDialog(e.toString()).then(() => redirectToLoginView());
}
}
Is that possible? I have read about the ExceptionHandler class, but I'm not sure if that class is suitable for this specific situation. Thanks.