Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Perryvw committed Oct 3, 2023
1 parent ecdd656 commit 3776337
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/pages/play/execute/fengari.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<empty error>";
}

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();
}
}
Expand All @@ -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 = "<empty error message>";
}
messages.push({ method: "error", data: [`Lua execution error:\n`, errorString] });
}
else
{
} else {
messages.push({ method: "error", data: [JSON.stringify(value)] });
}

Expand Down

0 comments on commit 3776337

Please sign in to comment.