Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Exception thrown from @Background method, is not logged  #2164

Copy link
Copy link
@marmor7

Description

@marmor7
Issue body actions

I've read #646, #677 and #682 they all talk about not hiding an exception thrown from @background from the global exception handler.
That works fine (Crashlytics gets the exceptions), but to get the thrown exception behaving like a regular exception it needs to be logged onto LogCat as well, currently the crash is hidden from logs.

The proper handling code should also have e.printStackTrace();

AndroidAnnotations version: 4.4.0

Android compile SDK version: 26

Annotated code:

@Background
methodInBackground() { ... }

Expected generated code:

BackgroundExecutor.execute(new BackgroundExecutor.Task("", 0L, "") {

            @Override
            public void execute() {
                try {
                    MyActivity_.super.methodInBackground();
                } catch (final Throwable e) {
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
                    e.printStackTrace(); // NEW
                }
            }
        }
        );

Actual generated code:

BackgroundExecutor.execute(new BackgroundExecutor.Task("", 0L, "") {

            @Override
            public void execute() {
                try {
                    MyActivity_.super.methodInBackground();
                } catch (final Throwable e) {
                    Thread.getDefaultUncaughtExceptionHandler().uncaughtException(Thread.currentThread(), e);
                }
            }
        }
        );
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.