Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Catcher is not triggered #230

Open
MichalNemec opened this issue Aug 18, 2022 · 1 comment · May be fixed by #234
Open

[BUG] Catcher is not triggered #230

MichalNemec opened this issue Aug 18, 2022 · 1 comment · May be fixed by #234
Assignees
Labels
New issue New issue which has not been checked yet

Comments

@MichalNemec
Copy link

Describe the bug
Basic settings and i dont see any dialog.

To Reproduce

import 'package:catcher/catcher.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await initServices();

  CatcherOptions debugOptions =
      CatcherOptions(DialogReportMode(), [ConsoleHandler()]);

  /// Release configuration. Same as above, but once user accepts dialog, user will be prompted to send email with crash to support.
  CatcherOptions releaseOptions = CatcherOptions(DialogReportMode(), [
    EmailManualHandler(["cy@as.as"])
  ]);

  Catcher(
    rootWidget: const MyApp(),
    debugConfig: debugOptions,
    releaseConfig: releaseOptions,
    enableLogger: true,
    ensureInitialized: true,
  );
  //runApp(const MyApp());
}

Future<void> initServices() async {
  print('starting services ...');
  await Get.putAsync(() => PrefsService().init());
  print('All services started...');
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    String initialPath = "/welcome";
    PrefsService storage = Get.find();

    return MaterialApp(
      /// STEP 3. Add navigator key from Catcher. It will be used to navigate user to report page or to show dialog.
      navigatorKey: Catcher.navigatorKey,
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: ChildWidget()),
    );
  }
}
class ChildWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
            child: TextButton(
                child: Text("Generate error"),
                onPressed: () => generateError()));
  }

  generateError() async {
    throw "Test exception";
  }
}

Expected behavior
see error dialog, to test it

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-arm, locale en-CZ)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.70.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Catcher version

  • Version: 0.6.9

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6] SIMULATOR iPhone 13 mini
  • OS: [e.g. iOS8.1] iOS 15.5

Additional context
running in vscode by run -> run without debugging | with debugging produces same stuff. Only exception in debug console as if catcher is not even there.

@MichalNemec MichalNemec added the New issue New issue which has not been checked yet label Aug 18, 2022
@calcitem
Copy link

calcitem commented Oct 6, 2022

calcitem/Sanmill@9de1aff

PlatformDispatcher.instance.onError = (error, stack) {
      
        Catcher.reportCheckedError(error, stack);
     
      return true;
    };

@ThexXTURBOXx ThexXTURBOXx linked a pull request Apr 17, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New issue New issue which has not been checked yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants