You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[√] Flutter (Channel stable, 3.16.0, on Microsoft Windows [Version 10.0.19045.3803], locale en-US)
• Flutter version 3.16.0 on channel stable at D:\Projects\2021\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db7ef5bf9f (8 weeks ago), 2023-11-15 11:25:44 -0800
• Engine revision 74d16627b9
• Dart version 3.2.0
• DevTools version 2.28.2
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at E:\Android\android-sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: E:\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.5.1)
• Visual Studio at E:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.5.33424.131
• Windows 10 SDK version 10.0.19041.0
[√] Android Studio (version 2022.2)
• Android Studio at E:\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[√] VS Code, 64-bit edition (version 1.85.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.80.0
[√] Connected device (4 available)
• SM G935F (mobile) • ad0516024000250aa3 • android-arm64 • Android 8.0.0 (API 26)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19045.3803]
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.200
• Edge (web) • edge • web-javascript • Microsoft Edge 120.0.2210.121
[√] Network resources
• All expected network resources are available.
• No issues found!
Dart Version
3.2.0
Steps to Reproduce
Is there a way to catch the exception (DioException (DioException [request cancelled]: The request was cancelled.)) thrown from the checkCancelledmethod ?
It seems to be impossible to do it by using the Dio package's public API and async/await keywords since the _dispatchRequestmethod is not being awaited for some reason 🤔 and the exception goes unhandled in this case.
Expected Result
Need a way to catch the DioException (DioException [request cancelled]: The request was cancelled.) exception.
Actual Result
The exception DioException (DioException [request cancelled]: The request was cancelled.) goes unhandled if the request is being cancelled using the CancelToken.
The text was updated successfully, but these errors were encountered:
stanbav
changed the title
Need a way to catch CancelException from the caller code
Need a way to catch DioException [request cancelled] from the caller code
Jan 9, 2024
@AlexV525, according to the Dart SDK collaborator, there is no issue in the Dart SDK dart-lang/sdk#47985 (comment)
If a Future with an error is not awaited - try/catch will not be able to catch it. As I stated in my first post - the Future returned by the catchErrormethod is not awaited, and therefore, there is no way to catch the error by wrapping the fetchmethod in the try/catch section.
So I believe that shows that something should be done in the Dio package, don't you agree?
So I believe that shows that something should be done in the Dio package, don't you agree?
Not really. If you uncheck the debugger setting with "uncaught exception" then it'll be caught normally. No matter you enabled that feature or not it can be caught eventually.
Package
dio
Version
5.3.3
Operating-System
Android, iOS, Web, MacOS, Linux, Windows
Output of
flutter doctor -v
Dart Version
3.2.0
Steps to Reproduce
Is there a way to catch the exception (
DioException (DioException [request cancelled]: The request was cancelled.)
) thrown from thecheckCancelled
method ?It seems to be impossible to do it by using the Dio package's public API and
async
/await
keywords since the_dispatchRequest
method is not being awaited for some reason 🤔 and the exception goes unhandled in this case.Expected Result
Need a way to catch the
DioException (DioException [request cancelled]: The request was cancelled.)
exception.Actual Result
The exception
DioException (DioException [request cancelled]: The request was cancelled.)
goes unhandled if the request is being cancelled using theCancelToken
.The text was updated successfully, but these errors were encountered: