nabil6391 / flutter_download_manager

Flutter Download Manager is a Cross-Platform file downloader with resumeable, parallel and batch Download support. Also be notified of download status and progress updates
MIT License
46 stars 29 forks source link

Please give us an option to disable rethrow #22

Open cristian1980 opened 5 months ago

cristian1980 commented 5 months ago

Right now when a device has connectivity issues(airplane mode) or tries do download an inaccessible resource we are getting an exception.

E/flutter ( 6650): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: DioException [bad response]: This exception was thrown because the response has a status code of 403 and RequestOptions.validateStatus was configured to throw for this status code. E/flutter ( 6650): The status code of 403 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled" E/flutter ( 6650): Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status E/flutter ( 6650): In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code. E/flutter ( 6650): E/flutter ( 6650): #0 DioMixin.fetch (package:dio/src/dio_mixin.dart:519:7) E/flutter ( 6650): E/flutter ( 6650): #1 DioForNative.download (package:dio/src/dio/dio_for_native.dart:46:18) E/flutter ( 6650): E/flutter ( 6650): #2 DownloadManager.download (package:flutter_download_manager/src/downloader.dart:94:24) E/flutter ( 6650):

I don't really see this being very useful in any way, more than that it's annoying when debugging. You could leave it enabled by default but please give us a parameter which we can pass to DownloadManager so we can disable this exception.

ThearyCoding commented 3 months ago

Download the package, import it into your project, and then delete the rethrow.