I am throwing exception like below;
if (response.statusCode == 400) {
LoginErrorResponse loginErrorResponse = LoginErrorResponse.fromMap(responseMap);
List<String> errorList = loginErrorResponse.getErrorList();
throw Exception(errorList);
}
And catching as below;
try {
AuthenticatedUser user = await reClient.login("test", "test");
} on Exception catch (ex, _) {
// parse from ex to -> List<string>?
}
I could not find a way to parse thrown exception into the List type. In debugger I can access to ex.message, but in the code it is not exposed.
What can I do?