Little more error handling

This commit is contained in:
Eric Bailey
2026-02-11 10:28:51 -06:00
parent 496a54b469
commit 2586450f73
+29 -14
View File
@@ -144,19 +144,32 @@ function GermSelfButton({did}: {did: string}) {
async function undo() { async function undo() {
if (!previousRecord) return if (!previousRecord) return
await agent.com.germnetwork.declaration.put( try {
{ await agent.com.germnetwork.declaration.put(
repo: did, {
rkey: 'self', repo: did,
}, rkey: 'self',
previousRecord, },
) previousRecord,
await whenAppViewReady(agent, did, res => !!res.data.associated?.germ) )
await queryClient.refetchQueries({queryKey: RQKEY(did)}) await whenAppViewReady(agent, did, res => !!res.data.associated?.germ)
await queryClient.refetchQueries({queryKey: RQKEY(did)})
Toast.show(_(msg`Germ DM reconnected`)) Toast.show(_(msg`Germ DM reconnected`))
ax.metric('profile:associated:germ:self-reconnect', {})
ax.metric('profile:associated:germ:self-reconnect', {}) } catch (e: any) {
Toast.show(
_(msg`Failed to reconnect Germ DM. Error: ${e?.message}`),
{
type: 'error',
},
)
if (!isNetworkError(e)) {
ax.logger.error('Failed to reconnect Germ DM link', {
safeMessage: e,
})
}
}
} }
selfExplanationDialogControl.close(() => { selfExplanationDialogControl.close(() => {
@@ -178,13 +191,15 @@ function GermSelfButton({did}: {did: string}) {
}, },
onError: error => { onError: error => {
Toast.show( Toast.show(
_(msg`Failed to remove Germ DM link. Error: ${error?.message}`), _(msg`Failed to disconnect Germ DM. Error: ${error?.message}`),
{ {
type: 'error', type: 'error',
}, },
) )
if (!isNetworkError(error)) { if (!isNetworkError(error)) {
ax.logger.error('Failed to remove Germ DM link', {safeMessage: error}) ax.logger.error('Failed to disconnect Germ DM link', {
safeMessage: error,
})
} }
}, },
}) })