Stopping sending literal errors
Errors now must be of "Error" type. Rule added in eslint.
This commit is contained in:
parent
88509916a8
commit
ab0f5e9837
19 changed files with 31 additions and 28 deletions
|
@ -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;
|
||||
|
|
|
@ -32,7 +32,7 @@ export class AuthenticateController extends BaseController {
|
|||
try {
|
||||
const { nonce, state, playUri, redirect } = parse(req.getQuery());
|
||||
if (!state || !nonce) {
|
||||
throw "missing state and nonce URL parameters";
|
||||
throw new Error("missing state and nonce URL parameters");
|
||||
}
|
||||
|
||||
const loginUri = await openIDClient.authorizationUrl(
|
||||
|
|
|
@ -27,7 +27,7 @@ export class OpenIdProfileController extends BaseController {
|
|||
try {
|
||||
const resCheckTokenAuth = await openIDClient.checkTokenAuth(accessToken as string);
|
||||
if (!resCheckTokenAuth.email) {
|
||||
throw "Email was not found";
|
||||
throw new Error("Email was not found");
|
||||
}
|
||||
res.end(
|
||||
this.buildHtml(
|
||||
|
|
|
@ -671,7 +671,7 @@ export class SocketManager implements ZoneEventListener {
|
|||
playGlobalMessageEvent: PlayGlobalMessage
|
||||
): Promise<void> {
|
||||
if (!client.tags.includes("admin")) {
|
||||
throw "Client is not an admin!";
|
||||
throw new Error("Client is not an admin!");
|
||||
}
|
||||
|
||||
const clientRoomUrl = client.roomId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue