You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-25 05:23:13 +03:00
Don't spuriously send unknown devices error
Send a sensible error message for other errors.
This commit is contained in:
@@ -107,6 +107,18 @@ MatrixCall.ERR_NO_USER_MEDIA = "no_user_media";
|
|||||||
*/
|
*/
|
||||||
MatrixCall.ERR_UNKNOWN_DEVICES = "unknown_devices";
|
MatrixCall.ERR_UNKNOWN_DEVICES = "unknown_devices";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Error code usewd when we fail to send the invite
|
||||||
|
* for some reason other than there being unknown devices
|
||||||
|
*/
|
||||||
|
MatrixCall.ERR_SEND_INVITE = "send_invite";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Error code usewd when we fail to send the answer
|
||||||
|
* for some reason other than there being unknown devices
|
||||||
|
*/
|
||||||
|
MatrixCall.ERR_SEND_ANSWER = "send_answer";
|
||||||
|
|
||||||
utils.inherits(MatrixCall, EventEmitter);
|
utils.inherits(MatrixCall, EventEmitter);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -594,13 +606,14 @@ MatrixCall.prototype._sendAnswer = function(stream) {
|
|||||||
// We've failed to answer: back to the ringing state
|
// We've failed to answer: back to the ringing state
|
||||||
setState(this, 'ringing');
|
setState(this, 'ringing');
|
||||||
this.client.cancelPendingEvent(error.event);
|
this.client.cancelPendingEvent(error.event);
|
||||||
this.emit(
|
|
||||||
"error",
|
let code = MatrixCall.ERR_SEND_ANSWER;
|
||||||
callError(
|
let message = "Failed to send answer";
|
||||||
MatrixCall.ERR_UNKNOWN_DEVICES,
|
if (error.name == 'UnknownDeviceError') {
|
||||||
"Unknown devices present in the room",
|
code = MatrixCall.ERR_UNKNOWN_DEVICES;
|
||||||
),
|
message = "Unknown devices present in the room";
|
||||||
);
|
}
|
||||||
|
this.emit("error", callError(code, message));
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -775,15 +788,16 @@ MatrixCall.prototype._gotLocalOffer = function(description) {
|
|||||||
}
|
}
|
||||||
}, MatrixCall.CALL_TIMEOUT_MS);
|
}, MatrixCall.CALL_TIMEOUT_MS);
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
|
let code = MatrixCall.ERR_SEND_INVITE;
|
||||||
|
let message = "Failed to send invite";
|
||||||
|
if (error.name == 'UnknownDeviceError') {
|
||||||
|
code = MatrixCall.ERR_UNKNOWN_DEVICES;
|
||||||
|
message = "Unknown devices present in the room";
|
||||||
|
}
|
||||||
|
|
||||||
self.client.cancelPendingEvent(error.event);
|
self.client.cancelPendingEvent(error.event);
|
||||||
terminate(self, "local", "unknown_devices", false);
|
terminate(self, "local", code, false);
|
||||||
self.emit(
|
self.emit("error", callError(code, message));
|
||||||
"error",
|
|
||||||
callError(
|
|
||||||
MatrixCall.ERR_UNKNOWN_DEVICES,
|
|
||||||
"Unknown devices present in the room",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
throw error;
|
throw error;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user