Clean up some sentry logs (#2630)
* Change prop name for sentry ingestion * Fix test * Add default object
This commit is contained in:
parent
3371038f7d
commit
bc502edae1
39 changed files with 84 additions and 147 deletions
|
@ -88,6 +88,6 @@ test('migrate: has legacy data, fails validation', async () => {
|
|||
expect(logger.error).toHaveBeenCalledWith(
|
||||
'persisted state: legacy data failed validation',
|
||||
// @ts-ignore
|
||||
{error: validate.error},
|
||||
{message: validate.error},
|
||||
)
|
||||
})
|
||||
|
|
|
@ -34,7 +34,7 @@ export async function init() {
|
|||
logger.log('persisted state: initialized')
|
||||
} catch (e) {
|
||||
logger.error('persisted state: failed to load root state from storage', {
|
||||
error: e,
|
||||
message: e,
|
||||
})
|
||||
// AsyncStorage failure, but we can still continue in memory
|
||||
return defaults
|
||||
|
@ -59,7 +59,7 @@ export async function write<K extends keyof Schema>(
|
|||
})
|
||||
} catch (e) {
|
||||
logger.error(`persisted state: failed writing root state to storage`, {
|
||||
error: e,
|
||||
message: e,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ async function onBroadcastMessage({data}: MessageEvent) {
|
|||
logger.error(
|
||||
`persisted state: failed handling update from broadcast channel`,
|
||||
{
|
||||
error: e,
|
||||
message: e,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,6 @@ export async function clear() {
|
|||
try {
|
||||
await AsyncStorage.removeItem(BSKY_STORAGE)
|
||||
} catch (e: any) {
|
||||
logger.error(`persisted store: failed to clear`, {error: e.toString()})
|
||||
logger.error(`persisted store: failed to clear`, {message: e.toString()})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue