From 37763379bdf106056e260502939ca79686878149 Mon Sep 17 00:00:00 2001 From: Perryvw Date: Tue, 3 Oct 2023 21:36:11 +0200 Subject: [PATCH] prettier --- src/pages/play/execute/fengari.worker.ts | 29 ++++++++---------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/pages/play/execute/fengari.worker.ts b/src/pages/play/execute/fengari.worker.ts index 5b4dcbd..09b50b9 100644 --- a/src/pages/play/execute/fengari.worker.ts +++ b/src/pages/play/execute/fengari.worker.ts @@ -47,26 +47,18 @@ function transformLuaValue(rootValue: any) { return transform(rootValue); } -function formatErrorData(errorObject: unknown): string -{ - if (!errorObject) - { +function formatErrorData(errorObject: unknown): string { + if (!errorObject) { return ""; } - if (typeof errorObject === "object") - { - if ("message" in errorObject) - { + if (typeof errorObject === "object") { + if ("message" in errorObject) { return errorObject["message"] as string; + } else { + return JSON.stringify(errorObject); } - else - { - return JSON.stringify(errorObject); - } - } - else - { + } else { return errorObject.toString(); } } @@ -90,14 +82,11 @@ function executeLua(code: string) { } } else if (status === lua.LUA_ERRRUN) { let errorString = formatErrorData(value); - if (errorString.length === 0) - { + if (errorString.length === 0) { errorString = ""; } messages.push({ method: "error", data: [`Lua execution error:\n`, errorString] }); - } - else - { + } else { messages.push({ method: "error", data: [JSON.stringify(value)] }); }