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
+4 -4
View File
@@ -39,7 +39,7 @@ export class AdminController extends BaseController {
try {
if (typeof body.roomId !== "string") {
throw "Incorrect roomId parameter";
throw new Error("Incorrect roomId parameter");
}
const roomId: string = body.roomId;
@@ -86,13 +86,13 @@ export class AdminController extends BaseController {
try {
if (typeof body.text !== "string") {
throw "Incorrect text parameter";
throw new Error("Incorrect text parameter");
}
if (body.type !== "capacity" && body.type !== "message") {
throw "Incorrect type parameter";
throw new Error("Incorrect type parameter");
}
if (!body.targets || typeof body.targets !== "object") {
throw "Incorrect targets parameter";
throw new Error("Incorrect targets parameter");
}
const text: string = body.text;
const type: string = body.type;