mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-24 12:04:57 +01:00
remove pending events that failed because of permanent error
so they don't get stuck
This commit is contained in:
parent
4ce66fc8a1
commit
9721432a8c
@ -63,9 +63,19 @@ export class SendQueue {
|
|||||||
pendingEvent.setWaiting();
|
pendingEvent.setWaiting();
|
||||||
} else {
|
} else {
|
||||||
log.catch(err);
|
log.catch(err);
|
||||||
|
const isPermanentError = err.name === "HomeServerError" && (
|
||||||
|
err.statusCode === 400 || // bad request, must be a bug on our end
|
||||||
|
err.statusCode === 403 || // forbidden
|
||||||
|
err.statusCode === 404 // not found
|
||||||
|
);
|
||||||
|
if (isPermanentError) {
|
||||||
|
log.set("remove", true);
|
||||||
|
await pendingEvent.abort();
|
||||||
|
} else {
|
||||||
pendingEvent.setError(err);
|
pendingEvent.setError(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user