You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-29 16:43:09 +03:00
Merge pull request #592 from matrix-org/dbkr/set_event_error
Set event error before emitting
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015, 2016 OpenMarket Ltd
|
||||||
Copyright 2017 Vector Creations Ltd
|
Copyright 2017 Vector Creations Ltd
|
||||||
|
Copyright 2018 New Vector Ltd
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@@ -1136,8 +1137,11 @@ function _sendEvent(client, room, event, callback) {
|
|||||||
console.error("Error sending event", err.stack || err);
|
console.error("Error sending event", err.stack || err);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
_updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
|
// set the error on the event before we update the status:
|
||||||
|
// updating the status emits the event, so the state should be
|
||||||
|
// consistent at that point.
|
||||||
event.error = err;
|
event.error = err;
|
||||||
|
_updatePendingEventStatus(room, event, EventStatus.NOT_SENT);
|
||||||
// also put the event object on the error: the caller will need this
|
// also put the event object on the error: the caller will need this
|
||||||
// to resend or cancel the event
|
// to resend or cancel the event
|
||||||
err.event = event;
|
err.event = event;
|
||||||
|
|||||||
Reference in New Issue
Block a user