import 'package:dio/dio.dart';

/// 网络请求的错误处理封装
Future<T> safeRequest<T>(
  Future<T> request, {
  void Function(DioException error)? onError,
}) async {
  try {
    return await request;
  } on DioException catch (e) {
    onError?.call(e); // 额外 hook
    rethrow; // 继续往上传
  }
}
