Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Adds exception handling for all places rust calls #12300

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

tarikeshaq
Copy link
Contributor

@tarikeshaq tarikeshaq commented Jun 7, 2022

Should fix the crash in mozilla/application-services#4990

A little effy about the bookmarks changes because of the default values of the GUIDs, but that seems better than a crash? I haven't tracked the callers yet

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

@tarikeshaq tarikeshaq requested a review from mhammond June 7, 2022 22:45
Copy link
Contributor

@mhammond mhammond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with your concerns around things like addItem (and addFolder - although I can't find a caller of that :) - returning an empty GUID isn't ideal, and looking at the one caller I can find, Fenix is still going to try and open a "bookmarks editor", which is probably going to have a bad time. Sadly I don't know what the correct answer there is, but it feels like the right option would be to make these results nullable, which will mean consumers are forced to deal with it in a meaningful way - but that's a fair bit more work as it crosses repos, and really isn't our call to make.

tl;dr - I'm fine with this if the Fenix team is and agree it's better than a crash, but think they should probably take on another issue to make it cleaner - possibly how I describe above, or possibly in some other way. So r=me, but don't take my word for it 😅

@mhammond
Copy link
Contributor

mhammond commented Jun 8, 2022

and looking at the one caller I can find

And looking more at that, it already handles PlacesException.UrlParseFailed and records telemetry for it - which this might break?

@tarikeshaq
Copy link
Contributor Author

And looking more at that, it already handles PlacesException.UrlParseFailed and records telemetry for it - which this might break?

Hmmm I'd like more insight from some Fenix folks on what to do here, I have a couple of options:

  1. Just don't add the exception handling for the bookmarks functions, I don't like this, and will most definitely keep crashing for some users
  2. For the bookmark functions, rethrow the UrlParseFailed but eat up the rest, i.e not use the handlePlacesExceptions function and instead another try, catch there - I like this, it's a quick change to help us stop the crashes and keeps the same behaviour. Then possibly a cleanup task can be made to make this all "better"
  3. Eat up the exception and it'll be a breaking change for fenix - I don't think this is feasible, but 🤷

For the sake of moving forward, I'll do option 2 in this PR, but happy to revert it back before landing

@tarikeshaq tarikeshaq requested a review from a team June 9, 2022 19:09
@mergify
Copy link
Contributor

mergify bot commented Jun 9, 2022

This pull request has conflicts when rebasing. Could you fix it @tarikeshaq? 🙏

@tarikeshaq tarikeshaq force-pushed the handle-exceptions-places branch 2 times, most recently from 0872019 to 3199cee Compare June 9, 2022 21:32
@tarikeshaq tarikeshaq added the 🕵️‍♀️ needs review PRs that need to be reviewed label Jun 9, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 14, 2022

This pull request has conflicts when rebasing. Could you fix it @tarikeshaq? 🙏

@jonalmeida jonalmeida self-requested a review June 16, 2022 16:14
@jonalmeida jonalmeida self-assigned this Jun 16, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 23, 2022

This pull request has conflicts when rebasing. Could you fix it @tarikeshaq? 🙏

@tarikeshaq
Copy link
Contributor Author

@jonalmeida have you had the time to take a look at this? 😬 I'll rebase with your feedback if you have some!

Copy link
Contributor

@jonalmeida jonalmeida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this review took a while. Please ping me if I'm blocking you in the future. 🙂

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🛬 needs landing PRs that are ready to land
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants