Stopping sending literal errors
Errors now must be of "Error" type. Rule added in eslint.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user