Page MenuHomePhabricator

[web] improve error handling when setting/getting userID
ClosedPublic

Authored by kamil on Dec 12 2023, 1:13 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 15, 10:37 PM
Unknown Object (File)
Sat, Sep 14, 5:09 PM
Unknown Object (File)
Sat, Sep 7, 9:26 AM
Unknown Object (File)
Sat, Sep 7, 9:26 AM
Unknown Object (File)
Sat, Sep 7, 9:26 AM
Unknown Object (File)
Fri, Sep 6, 10:29 PM
Unknown Object (File)
Fri, Sep 6, 3:06 PM
Unknown Object (File)
Jul 29 2024, 10:52 AM
Subscribers

Details

Summary
  1. Making errors more descriptive
  2. When we cannot not get userID we should delete database
Test Plan
  1. Throw errors from setting/getting userID and check if errors are printed.
  2. Throw error from getting and make sure database is deleted

Diff Detail

Repository
rCOMM Comm
Branch
not-init-fixed
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Dec 13 2023, 2:03 AM
tomek requested changes to this revision.Dec 13 2023, 4:59 AM
tomek added inline comments.
web/database/sqlite-data-handler.js
43–59

It is possible that await databaseModule.init({ clearDatabase: true }); will throw and we catch it, and then

await databaseModule.schedule({
          type: workerRequestMessageTypes.SET_CURRENT_USER_ID,
          userID: currentLoggedInUserID,
        });

will succeed... won't that result in assigning a new user to the old data?

This revision now requires changes to proceed.Dec 13 2023, 4:59 AM

ealry return on clearing data failure

web/database/sqlite-data-handler.js
43–59

yes, good catch, fixed

This revision is now accepted and ready to land.Dec 15 2023, 6:25 AM