Closed Bug 1645114 Opened 6 years ago Closed 2 years ago

Don't throw exceptions from methods that return GeckoResult

Categories

(GeckoView :: General, defect, P2)

Unspecified
All
defect

Tracking

(firefox127 fixed)

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: snorp, Assigned: polly)

References

Details

(Keywords: good-first-bug)

Attachments

(1 file)

When calling a method that returns a GeckoResult, it's a fair expectation that any errors will come via the returned GeckoResult instead via a thrown exception. If you have to handle both, it makes for some ugly code:

try {
    foo.bar().then(val -> {
        // do something with val
    }, ex -> {
        // error handling
    });
} catch (IllegalStateException e) {
   // more error handling
}

We should change any spots where we throw in these cases to fail the returned GeckoResult instead.

See also bug 1644998 as one of the signatures that show this problem.

See Also: → 1644998
Severity: -- → S3
Priority: -- → P2
Whiteboard: good-first-bug
Keywords: good-first-bug
Whiteboard: good-first-bug
See Also: → 1746521
Assignee: nobody → pmceldowney

Also remove exception handling at call site in Android components - no need to catch exceptions for method that no longer throws.

Pushed by pmceldowney@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/181b60bf152b for screenshot capture, include exception in failure result rather than throwing. r=geckoview-reviewers,tthibaud,twhite
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: