Make sure failed messages enter error state (#4210)

zio/stable
Eric Bailey 2024-05-24 10:01:30 -05:00 committed by GitHub
parent 85782aeb93
commit 2897b79bef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 2 deletions

View File

@ -830,9 +830,10 @@ export class Convo {
if (NETWORK_FAILURE_STATUSES.includes(e.status)) { if (NETWORK_FAILURE_STATUSES.includes(e.status)) {
this.pendingMessageFailure = 'recoverable' this.pendingMessageFailure = 'recoverable'
} else { } else {
this.pendingMessageFailure = 'unrecoverable'
switch (e.message) { switch (e.message) {
case 'block between recipient and sender': case 'block between recipient and sender':
this.pendingMessageFailure = 'unrecoverable'
this.emitter.emit('event', { this.emitter.emit('event', {
type: 'invalidate-block-state', type: 'invalidate-block-state',
accountDids: [ accountDids: [
@ -842,9 +843,14 @@ export class Convo {
}) })
break break
case 'Account is disabled': case 'Account is disabled':
this.pendingMessageFailure = 'unrecoverable'
this.dispatch({event: ConvoDispatchEvent.Disable}) this.dispatch({event: ConvoDispatchEvent.Disable})
break break
case 'Convo not found':
case 'Account does not exist':
case 'recipient does not exist':
case 'recipient requires incoming messages to come from someone they follow':
case 'recipient has disabled incoming messages':
break
default: default:
logger.warn( logger.warn(
`Convo handleSendMessageFailure could not handle error`, `Convo handleSendMessageFailure could not handle error`,
@ -857,6 +863,7 @@ export class Convo {
} }
} }
} else { } else {
this.pendingMessageFailure = 'unrecoverable'
logger.error(e, { logger.error(e, {
context: `Convo handleSendMessageFailure received unknown error`, context: `Convo handleSendMessageFailure received unknown error`,
}) })