ThexXTURBOXx / catcher_2

Flutter error catching & handling plugin. Handles and reports exceptions in your app!
https://pub.dev/packages/catcher_2
Apache License 2.0
23 stars 26 forks source link

Instance of 'FileHandler' failed to report error #25

Closed laterdayi closed 9 months ago

laterdayi commented 9 months ago

Description

Instance of 'FileHandler' failed to report error Unable to create log file and write log

Minimal Reproduction

  runZonedGuarded<Future<void>>(() async {
    WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
    FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);

    String path = "/storage/emulated/0/log.txt";
    final catcher2 = Catcher2(rootWidget: const MyApp(), ensureInitialized: true);
    Catcher2Options debugOptions = Catcher2Options(
      SilentReportMode(),
      [
        ConsoleHandler(),
        FileHandler(
          File(path),
          printLogs: true,
        )
      ],
    );
    Catcher2Options releaseOptions = Catcher2Options(SilentReportMode(), []);
    catcher2.updateConfig(
      debugConfig: debugOptions,
      releaseConfig: releaseOptions,
    );

    await Global.init();
    runApp(const MyApp());
    handleSetStatusBar();
    FlutterNativeSplash.remove();

Exception or Error

2
I/flutter ( 4282): [2024-02-18 16:15:17.763066 | Catcher 2 | INFO] Report result: true
2
I/flutter ( 4282): [2024-02-18 16:15:17.763295 | Catcher 2 | INFO] Report result: false
2
I/flutter ( 4282): [2024-02-18 16:15:17.763398 | Catcher 2 | WARNING] Instance of 'FileHandler' failed to report error

Expected Behaviour

2
I/flutter ( 4282): [2024-02-18 16:15:17.763066 | Catcher 2 | INFO] Report result: true
2
I/flutter ( 4282): [2024-02-18 16:15:17.763295 | Catcher 2 | INFO] Report result: false
2
I/flutter ( 4282): [2024-02-18 16:15:17.763398 | Catcher 2 | WARNING] Instance of 'FileHandler' failed to report error

Screenshots

No response

Additional context

No response

Device

*

OS

*

Flutter version

*

catcher_2 version

*

Checklist

ThexXTURBOXx commented 9 months ago

You should neither use runApp yourself nor use runZoneGuarded. Please follow the README for the setup instructions.

laterdayi commented 9 months ago

Does not work after deletion