Commit 0cfd51f
committed
Don't swallow up errors coming from the shareSession call
A call to ensureSession() has two steps:
1. prepareSession(), where an outbound group session might get created
or rotated
2. shareSession(), where an outbound group session might get
encrypted and queued up to be sent to other devices
Both of those calls may mostly fail due to storage errors, yet only the
errors from prepareSession get propagated to the caller.
Errors from prepareSession will mean that you can't get an
outbound group session so you can't encrypt an event.
Errors from shareSession, especially if the error happens in the part
where the to-device requests are queued up to be sent out, mean that
other people will not be able to decrypt the events that will get
encrypted using the outbound group session.
Both of those cases are catastrophic, the second case is just much
harder to debug, since the error happens on another device at some
arbitrary point in the future.
Let's just return the error instead, people can then retry and the
storage issue might have been resolved, or at least the error becomes
visible when it happens.1 parent a62c607 commit 0cfd51f
1 file changed
+2
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
296 | | - | |
297 | 295 | | |
298 | 296 | | |
299 | 297 | | |
| |||
302 | 300 | | |
303 | 301 | | |
304 | 302 | | |
| 303 | + | |
305 | 304 | | |
306 | 305 | | |
| 306 | + | |
307 | 307 | | |
308 | | - | |
309 | | - | |
310 | 308 | | |
311 | 309 | | |
312 | 310 | | |
| |||
0 commit comments