Skip to content

Commit

Permalink
Improve error handling in download provider with detailed exception m…
Browse files Browse the repository at this point in the history
…essages (#81)
  • Loading branch information
ActiveChooN authored Jan 21, 2025
1 parent 2a16293 commit 59919f5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/providers/download_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class DownloadProvider extends ChangeNotifier {
return Response(requestOptions: RequestOptions(path: url));
} else {
_cancelToken?.cancel();
throw e;
final errorMessage = e is DioException ? e.message : 'An unknown error occurred';
throw Exception('Download failed for $url: $errorMessage');
}
}).then((_) => state.done);
promises.add(promise);
Expand Down

0 comments on commit 59919f5

Please sign in to comment.