Stopping sending literal errors

Errors now must be of "Error" type.
Rule added in eslint.
This commit is contained in:
David Négrier 2022-01-06 10:49:44 +01:00
parent 88509916a8
commit ab0f5e9837
19 changed files with 31 additions and 28 deletions

View file

@ -123,7 +123,7 @@ export class SimplePeer {
peerConnection.destroy();
const peerConnexionDeleted = this.PeerConnectionArray.delete(user.userId);
if (!peerConnexionDeleted) {
throw "Error to delete peer connection";
throw new Error("Error to delete peer connection");
}
//return this.createPeerConnection(user, localStream);
} else {
@ -177,7 +177,7 @@ export class SimplePeer {
peerConnection.destroy();
const peerConnexionDeleted = this.PeerScreenSharingConnectionArray.delete(user.userId);
if (!peerConnexionDeleted) {
throw "Error to delete peer connection";
throw new Error("Error to delete peer connection");
}
this.createPeerConnection(user);
} else {
@ -229,7 +229,7 @@ export class SimplePeer {
const userIndex = this.Users.findIndex((user) => user.userId === userId);
if (userIndex < 0) {
throw "Couldn't delete user";
throw new Error("Couldn't delete user");
} else {
this.Users.splice(userIndex, 1);
}