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)) {
this.pendingMessageFailure = 'recoverable'
} else {
this.pendingMessageFailure = 'unrecoverable'
switch (e.message) {
case 'block between recipient and sender':
this.pendingMessageFailure = 'unrecoverable'
this.emitter.emit('event', {
type: 'invalidate-block-state',
accountDids: [
@ -842,9 +843,14 @@ export class Convo {
})
break
case 'Account is disabled':
this.pendingMessageFailure = 'unrecoverable'
this.dispatch({event: ConvoDispatchEvent.Disable})
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:
logger.warn(
`Convo handleSendMessageFailure could not handle error`,
@ -857,6 +863,7 @@ export class Convo {
}
}
} else {
this.pendingMessageFailure = 'unrecoverable'
logger.error(e, {
context: `Convo handleSendMessageFailure received unknown error`,
})