Fix lint & prettier issues
This commit is contained in:
parent
5a0eec1eb9
commit
163ee872bf
@ -1,7 +1,7 @@
|
||||
import { Server } from "hyper-express";
|
||||
import Response from "hyper-express/types/components/http/Response";
|
||||
import axios from "axios";
|
||||
import {isErrorApiData} from "../Messages/JsonMessages/ErrorApiData";
|
||||
import { isErrorApiData } from "../Messages/JsonMessages/ErrorApiData";
|
||||
|
||||
export class BaseHttpController {
|
||||
constructor(protected app: Server) {
|
||||
|
@ -22,7 +22,6 @@ import {
|
||||
FollowAbortMessage,
|
||||
VariableMessage,
|
||||
LockGroupPromptMessage,
|
||||
ErrorScreenMessage,
|
||||
} from "../Messages/generated/messages_pb";
|
||||
import { UserMovesMessage } from "../Messages/generated/messages_pb";
|
||||
import { parse } from "query-string";
|
||||
@ -41,7 +40,7 @@ import { localWokaService } from "../Services/LocalWokaService";
|
||||
import { WebSocket } from "uWebSockets.js";
|
||||
import { WokaDetail } from "../Messages/JsonMessages/PlayerTextures";
|
||||
import { z } from "zod";
|
||||
import {ErrorApiData, isErrorApiData} from "../Messages/JsonMessages/ErrorApiData";
|
||||
import { ErrorApiData, isErrorApiData } from "../Messages/JsonMessages/ErrorApiData";
|
||||
|
||||
/**
|
||||
* The object passed between the "open" and the "upgrade" methods when opening a websocket
|
||||
@ -324,20 +323,20 @@ export class IoSocketController {
|
||||
} catch (err) {
|
||||
if (Axios.isAxiosError(err)) {
|
||||
const errorType = isErrorApiData.safeParse(err?.response?.data);
|
||||
if(errorType.success) {
|
||||
return res.upgrade(
|
||||
{
|
||||
rejected: true,
|
||||
reason: "error",
|
||||
status: err?.response?.status,
|
||||
error: errorType.data,
|
||||
} as UpgradeFailedData,
|
||||
websocketKey,
|
||||
websocketProtocol,
|
||||
websocketExtensions,
|
||||
context
|
||||
);
|
||||
}
|
||||
if (errorType.success) {
|
||||
return res.upgrade(
|
||||
{
|
||||
rejected: true,
|
||||
reason: "error",
|
||||
status: err?.response?.status,
|
||||
error: errorType.data,
|
||||
} as UpgradeFailedData,
|
||||
websocketKey,
|
||||
websocketProtocol,
|
||||
websocketExtensions,
|
||||
context
|
||||
);
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ import Debug from "debug";
|
||||
import { ExAdminSocketInterface } from "../Model/Websocket/ExAdminSocketInterface";
|
||||
import { compressors } from "hyper-express";
|
||||
import { isMapDetailsData } from "../Messages/JsonMessages/MapDetailsData";
|
||||
import {ErrorApiData} from "../Messages/JsonMessages/ErrorApiData";
|
||||
import { ErrorApiData } from "../Messages/JsonMessages/ErrorApiData";
|
||||
|
||||
const debug = Debug("socket");
|
||||
|
||||
@ -654,10 +654,11 @@ export class SocketManager implements ZoneEventListener {
|
||||
errorMessage.setDetails(error.details);
|
||||
errorMessage.setImage(error.image);
|
||||
|
||||
if(error.urlToRedirect) errorMessage.setUrltoredirect(error.urlToRedirect);
|
||||
if(error.buttonTitle) errorMessage.setButtontitle(error.buttonTitle);
|
||||
if(!!error.canRetryManual) errorMessage.setCanretrymanual(error.canRetryManual);
|
||||
if(error.timeToRetry && !isNaN(Number(error.timeToRetry))) errorMessage.setTimetoretry(Number(error.timeToRetry));
|
||||
if (error.urlToRedirect) errorMessage.setUrltoredirect(error.urlToRedirect);
|
||||
if (error.buttonTitle) errorMessage.setButtontitle(error.buttonTitle);
|
||||
if (!!error.canRetryManual) errorMessage.setCanretrymanual(error.canRetryManual);
|
||||
if (error.timeToRetry && !isNaN(Number(error.timeToRetry)))
|
||||
errorMessage.setTimetoretry(Number(error.timeToRetry));
|
||||
|
||||
const serverToClientMessage = new ServerToClientMessage();
|
||||
serverToClientMessage.setErrorscreenmessage(errorMessage);
|
||||
|
Loading…
Reference in New Issue
Block a user