feat:更新网络工具类返回的异常错误
This commit is contained in:
@@ -108,7 +108,7 @@ class HttpUtil {
|
||||
// 没有转换器时尝试直接返回(可能不安全,建议提供转换器)
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
rethrow;
|
||||
throw Exception(_handleError(e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ class HttpUtil {
|
||||
);
|
||||
|
||||
// 错误处理
|
||||
void _handleError(dynamic error) {
|
||||
String _handleError(dynamic error) {
|
||||
String errorMessage = '未知错误';
|
||||
if (error is DioException) {
|
||||
switch (error.type) {
|
||||
@@ -218,7 +218,7 @@ class HttpUtil {
|
||||
}
|
||||
|
||||
logger.e(errorMessage);
|
||||
// showErrorToast(errorMessage);
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
String _getHttpErrorMessage(int statusCode) {
|
||||
|
||||
Reference in New Issue
Block a user