Clean up some sentry logs (#2630)

* Change prop name for sentry ingestion

* Fix test

* Add default object
This commit is contained in:
Eric Bailey 2024-01-25 23:11:01 -06:00 committed by GitHub
parent 3371038f7d
commit bc502edae1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 84 additions and 147 deletions

View file

@ -127,34 +127,6 @@ export async function migrate() {
const newData = await read()
const alreadyMigrated = Boolean(newData)
/* TODO BEGIN DEBUG — remove this eventually */
try {
if (rawLegacyData) {
const legacy = JSON.parse(rawLegacyData) as Partial<LegacySchema>
logger.info(`persisted state: debug legacy data`, {
hasExistingLoggedInAccount: Boolean(legacy?.session?.data),
numberOfExistingAccounts: legacy?.session?.accounts?.length,
foundExistingCurrentAccount: Boolean(
legacy.session?.accounts?.find(
a => a.did === legacy.session?.data?.did,
),
),
})
logger.info(`persisted state: debug new data`, {
hasNewData: Boolean(newData),
hasExistingLoggedInAccount: Boolean(newData?.session?.currentAccount),
numberOfExistingAccounts: newData?.session?.accounts?.length,
existingAccountMatchesLegacy: Boolean(
newData?.session?.currentAccount?.did ===
legacy?.session?.data?.did,
),
})
}
} catch (e: any) {
logger.error(e, {message: `persisted state: legacy debugging failed`})
}
/* TODO END DEBUG */
if (!alreadyMigrated && rawLegacyData) {
logger.info('persisted state: migrating legacy storage')
@ -167,7 +139,7 @@ export async function migrate() {
logger.info('persisted state: migrated legacy storage')
} else {
logger.error('persisted state: legacy data failed validation', {
error: validate.error,
message: validate.error,
})
}
} else {
@ -185,7 +157,7 @@ export async function clearLegacyStorage() {
await AsyncStorage.removeItem(DEPRECATED_ROOT_STATE_STORAGE_KEY)
} catch (e: any) {
logger.error(`persisted legacy store: failed to clear`, {
error: e.toString(),
message: e.toString(),
})
}
}