ueman / feedback

A simple widget for getting better feedback.
https://pub.dev/packages/feedback
378 stars 92 forks source link

Exception is not getting in try catch block #289

Closed ilyasarafath closed 3 months ago

ilyasarafath commented 3 months ago

Version

3.0.0

Library

feedback_sentry

Flutter channel

stable

Flutter version

3.19.2

Platform

Android, iOS

Details

Am using feedbacksentry package to capture user feed and send to Sentry, The internal exception is not caught in the catch block ` try { BetterFeedback.of(context).showAndUploadToSentry( name: "Test", email: AppConstants.supportMail, ); } catch () { //exception not catching here }`

Steps to reproduce

  1. Without initialising the sentry try call "showAndUploadToSentry" method 2.This time internal exception will trigger, but not getting exception in "catch" block

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.19.2, on macOS 14.3.1 23D60 darwin-arm64, locale en-IN)
    • Flutter version 3.19.2 on channel stable at /Users/ilyasarafath/Documents/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7482962148 (3 weeks ago), 2024-02-27 16:51:22 -0500
    • Engine revision 04817c99c9
    • Dart version 3.3.0
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/ilyasarafath/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/ilyasarafath/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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.7+0-17.0.7b1000.6-10550314)

[✓] VS Code (version 1.87.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.84.0

[✓] Connected device (3 available)            
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 14 (API 34)
      (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 14.3.1 23D60
      darwin-arm64
    • Chrome (web)                • chrome        • web-javascript • Google Chrome
      123.0.6312.58

[✓] Network resources
    • All expected network resources are available.

• No issues found!
ueman commented 3 months ago

This kind of try catch will never work due to how this code and Flutter fundamentally works. So unfortunately I can't do anything

ilyasarafath commented 3 months ago

Is it possible return "true" or "false" from this function "showAndUploadToSentry" based on the result?

ueman commented 3 months ago

For any customization beyond the default API you have to go custom. Then you can catch exceptions, know the result and so on.