Little more error handling
This commit is contained in:
@@ -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,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user