handleCatch method
Handle Error and Exception
统一处理子类的异常情况
e
,有可能是Error,也有可能是Exception.所以需要判断处理
s
为堆栈信息
Implementation
void handleCatch(e, s, {bool hintError = true}) {
// DioError的判断,理论不应该拿进来,增强了代码耦合性,抽取为时组件时.应移除
if (e.error != null && e.error is UnAuthorizedException) {
setUnAuthorized();
} else {
debugPrint('error--->\n$e');
debugPrint('stack--->\n$s');
if (hintError) setError(e is Error ? e.toString() : e.message);
}
}