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)
Tue, Oct 22, 9:19 AM
Unknown Object (File)
Tue, Oct 22, 8:58 AM
Unknown Object (File)
Tue, Oct 22, 5:31 AM
Unknown Object (File)
Tue, Oct 22, 5:31 AM
Unknown Object (File)
Tue, Oct 22, 5:31 AM
Unknown Object (File)
Sep 15 2024, 10:37 PM
Unknown Object (File)
Sep 14 2024, 5:09 PM
Unknown Object (File)
Sep 7 2024, 9:26 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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 ↗(On Diff #34514)

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 ↗(On Diff #34514)

yes, good catch, fixed

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