HomePhabricator
Diffusion Comm f6e25e7d0623

[native] Throw JSError in sync functions

Description

[native] Throw JSError in sync functions

Summary:
ENG-1471, code is based on this diff
Changes processMessageStoreOperationsSync and processThreadStoreOperationsSync to throw JSErrors instead of returning a boolean. Corresponding javascript code was changed from checking return value to a try/catch.

Test Plan:
Test on both Android and iOS.

  1. Place temporary throw std::system_error(ECANCELED, std::generic_category(), "error"); outside the for loop in processMessageStoreOperationsSync and build the app.
  2. Try and call the method with an empty array somewhere from javascript.
  3. The app shouldn't crash and should display that there was a JSError.

Reviewers: atul, marcin, jon, tomek

Reviewed By: marcin, tomek

Subscribers: marcin, ashoat, abosh

Differential Revision: https://phab.comm.dev/D5201

Details

Provenance
Michal Gniadek <michal.gniadek@swmansion.com>Authored on Oct 5 2022, 4:03 AM
Reviewer
marcin
Differential Revision
D5201: [native] Throw JSError in sync functions
Parents
rCOMMaff69f3bb242: [native] Add license for sqlite_orm
Branches
Unknown
Tags
Unknown

Event Timeline

Michal Gniadek <michal.gniadek@swmansion.com> committed rCOMMf6e25e7d0623: [native] Throw JSError in sync functions (authored by Michal Gniadek <michal.gniadek@swmansion.com>).Oct 5 2022, 4:59 AM