Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/lgn-electron/electron/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ function createWindow() {
mainWindow.loadURL(configuration.source.value).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the ${configuration.source.value} url: `,
`An error occurred while loading the ${configuration.source.value} url: `,
error
);
});
} else {
loadUrl(mainWindow).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the index.html file located under ${configuration.source.value}: `,
`An error occurred while loading the index.html file located under ${configuration.source.value}: `,
error
);
});
Expand Down
4 changes: 2 additions & 2 deletions npm-pkgs/lgn-analytics-gui/src/electron/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ const createWindow = () => {
mainWindow.loadURL(devUrl).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the ${devUrl} url: `,
`An error occurred while loading the ${devUrl} url: `,
error
);
});
} else {
loadUrl(mainWindow).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the index.html file located under ${indexHtmlDirPath}: `,
`An error occurred while loading the index.html file located under ${indexHtmlDirPath}: `,
error
);
});
Expand Down
20 changes: 12 additions & 8 deletions npm-pkgs/lgn-analytics-gui/src/routes/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@
// TODO: Here we can control the UI and display a modal or change the page content
onMount(() => {
if (initAuthStatus?.type === "error") {
window.location.href = initAuthStatus.authorizationUrl;
if (initAuthStatus.authorizationUrl) {
window.location.href = initAuthStatus.authorizationUrl;
} else {
log.warn("auth", "User is not authed");
}
}

const unsubscribe = theme.subscribe(({ name }) => {
Expand All @@ -194,16 +198,16 @@
});
</script>

{#if initAuthStatus?.type !== "error"}
<Notifications store={notifications} />
<!-- {#if initAuthStatus?.type !== "error"} -->
<Notifications store={notifications} />

<LoadingBar />
<LoadingBar />

<div class="layout">
<slot />
</div>
{/if}
<div class="layout">
<slot />
</div>

<!-- {/if} -->
<style lang="postcss">
.layout {
@apply antialiased w-full flex flex-col;
Expand Down
32 changes: 24 additions & 8 deletions npm-pkgs/lgn-editor-gui/src/components/ResourceBrowser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@
payload: {
type: "raw",
title: "Resources",
message: "An error occured while renaming the resource",
message: "An error occurred while renaming the resource",
},
});

log.error(
log.json`An error occured while renaming the resource ${entry.item}: ${error}`
log.json`An error occurred while renaming the resource ${entry.item}: ${error}`
);
}
}
Expand Down Expand Up @@ -218,7 +218,11 @@
);

if (newResource) {
await fetchAllResources();
try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}

if (newResource.new_id) {
const entry = $resourceEntries.find(
Expand Down Expand Up @@ -341,7 +345,11 @@
sourceId: $currentResourceDescriptionEntry.item.id,
});

await fetchAllResources();
try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}

if (newResource) {
const entry = $resourceEntries.find(
Expand Down Expand Up @@ -396,7 +404,11 @@
ids: [$currentResourceDescriptionEntry.item.id],
});

await fetchAllResources();
try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}

break;
}
Expand Down Expand Up @@ -497,7 +509,11 @@
newPath,
});

await fetchAllResources();
try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}
}

function openRemoveResourcePrompt(symbolKey: string) {
Expand Down Expand Up @@ -544,12 +560,12 @@
payload: {
type: "raw",
title: "Resources",
message: "An error occured while removing the resource",
message: "An error occurred while removing the resource",
},
});

log.error(
log.json`An error occured while removing the resource ${$currentResourceDescriptionEntry.item}: ${error}`
log.json`An error occurred while removing the resource ${$currentResourceDescriptionEntry.item}: ${error}`
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<script lang="ts">
import { PanelHeader } from "@lgn/web-client/src/components/panel";
import { displayError } from "@lgn/web-client/src/lib/errors";
import log from "@lgn/web-client/src/lib/log";
import { filterContextMenuEvents } from "@lgn/web-client/src/types/contextMenu";
import type { ContextMenuEvent } from "@lgn/web-client/src/types/contextMenu";

Expand Down Expand Up @@ -29,7 +31,13 @@
await revertResources({
ids: [$selectedLocalChange.info.id],
});
await fetchAllResources();

try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}

break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<PropertyGridHeader resources={[$currentResource]} {search} />
{/if}
{#if $currentResourceError}
<div class="italic">An error occured</div>
<div class="italic">An error occurred</div>
{:else if !$currentResource}
<div class="italic">No resource selected</div>
{:else if !$currentResource.properties.length}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import type { Common, ResourceBrowser } from "@lgn/api/editor";
import Button from "@lgn/web-client/src/components/Button.svelte";
import Modal from "@lgn/web-client/src/components/modal/Modal.svelte";
import { displayError } from "@lgn/web-client/src/lib/errors";
import log from "@lgn/web-client/src/lib/log";
import { createAsyncStoreOrchestrator } from "@lgn/web-client/src/orchestrators/async";

Expand Down Expand Up @@ -73,7 +74,11 @@

close();

await fetchAllResources();
try {
await fetchAllResources();
} catch (error) {
log.error("resources", displayError(error));
}
});
}
</script>
Expand Down
4 changes: 2 additions & 2 deletions npm-pkgs/lgn-editor-gui/src/electron/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ const createWindow = () => {
mainWindow.loadURL(devUrl).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the ${devUrl} url: `,
`An error occurred while loading the ${devUrl} url: `,
error
);
});
} else {
loadUrl(mainWindow).catch((error) => {
console.error(
"electron::start",
`An error occured while loading the index.html file located under ${indexHtmlDirPath}: `,
`An error occurred while loading the index.html file located under ${indexHtmlDirPath}: `,
error
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const { error: allActiveScenesError } = allActiveSceneIdsOrchestrator;

export async function fetchAllActiveScenes() {
try {
return allActiveSceneIdsOrchestrator.run(getActiveSceneIds);
return await allActiveSceneIdsOrchestrator.run(getActiveSceneIds);
} catch (error) {
allActiveScenesOrchestrator.error.set(error);
}
Expand Down
8 changes: 7 additions & 1 deletion npm-pkgs/lgn-editor-gui/src/orchestrators/allResources.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import type { Common } from "@lgn/api/editor";
import { displayError } from "@lgn/web-client/src/lib/errors";
import log from "@lgn/web-client/src/lib/log";
import type { AsyncOrchestrator } from "@lgn/web-client/src/orchestrators/async";
import { createAsyncStoreListOrchestrator } from "@lgn/web-client/src/orchestrators/async";

Expand All @@ -23,7 +25,11 @@ export async function fetchAllResources(name?: string) {
getAllResources(name)
);

await fetchStagedResources();
try {
await fetchStagedResources();
} catch (error) {
log.error("staged-resources", displayError(error));
}

return allResources;
}
Expand Down
4 changes: 2 additions & 2 deletions npm-pkgs/lgn-editor-gui/src/orchestrators/currentResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ export async function fetchCurrentResourceDescription(
payload: {
type: "raw",
title: "Resources",
message: "An error occured while loading the resource",
message: "An error occurred while loading the resource",
},
});

log.error(
log.json`An error occured while loading the resource ${id}: ${error}`
log.json`An error occurred while loading the resource ${id}: ${error}`
);
}
}
Expand Down
8 changes: 4 additions & 4 deletions npm-pkgs/lgn-editor-gui/src/orchestrators/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import {
export function initMessageStream() {
async function rec(): Promise<void> {
const message = await getLastMessage().catch((error) => {
log.error("messages", `An error occured: ${displayError(error)}`);
log.error("messages", `An error occurred: ${displayError(error)}`);
});

if (!message) {
return rec().catch((error) => {
log.error("messages", `An error occured: ${displayError(error)}`);
log.error("messages", `An error occurred: ${displayError(error)}`);
});
}

Expand Down Expand Up @@ -76,12 +76,12 @@ export function initMessageStream() {
}

await rec().catch((error) => {
log.error("messages", `An error occured: ${displayError(error)}`);
log.error("messages", `An error occurred: ${displayError(error)}`);
});
}

rec().catch((error) =>
log.error("messages", `An error occured: ${displayError(error)}`)
log.error("messages", `An error occurred: ${displayError(error)}`)
);

return () => {
Expand Down
18 changes: 11 additions & 7 deletions npm-pkgs/lgn-editor-gui/src/routes/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@

onMount(async () => {
if ($authStatus?.type === "error") {
window.location.href = $authStatus.authorizationUrl;
if ($authStatus.authorizationUrl) {
window.location.href = $authStatus.authorizationUrl;
} else {
log.warn("auth", "User is not authed");
}
}

const initLogStreamSubscriptions = initLogStreams();
Expand Down Expand Up @@ -271,12 +275,12 @@
});
</script>

{#if $authStatus?.type !== "error"}
<ModalContainer store={modal} />
<!-- {#if $authStatus?.type !== "error"} -->
<ModalContainer store={modal} />

<ContextMenu store={contextMenu} />
<ContextMenu store={contextMenu} />

<Notifications store={notifications} />
<Notifications store={notifications} />

<slot />
{/if}
<slot />
<!-- {/if} -->
10 changes: 6 additions & 4 deletions npm-pkgs/lgn-editor-gui/src/routes/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import Layout from "@lgn/web-client/src/components/layout/Layout.svelte";
import type { MenuItemDescription } from "@lgn/web-client/src/components/menu/lib/MenuItemDescription";
import { EmptyPanel, Panel } from "@lgn/web-client/src/components/panel";
import { displayError } from "@lgn/web-client/src/lib/errors";
import log from "@lgn/web-client/src/lib/log";

import { closeScene } from "@/api";
import DynamicPanel from "@/components/DynamicPanel.svelte";
Expand Down Expand Up @@ -49,14 +51,14 @@
});

$: if ($allResourcesError) {
refetchResources().catch(() => {
// TODO: Handle errors
refetchResources().catch((error) => {
log.error("resources", displayError(error));
});
}

onMount(async () => {
refetchResources().catch(() => {
// TODO: Handle errors
refetchResources().catch((error) => {
log.error("resources", displayError(error));
});

await fetchAllActiveScenes();
Expand Down
4 changes: 2 additions & 2 deletions npm-pkgs/lgn-editor-gui/src/stores/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function initLogStreams() {
processLogStreamResponse(traceEventsResponse.value, "editor");
})
.catch((error) => {
log.error("log::editor", `an error occured: ${displayError(error)}`);
log.error("log::editor", `an error ocurred: ${displayError(error)}`);
});
}, 2_000);

Expand All @@ -68,7 +68,7 @@ export function initLogStreams() {
processLogStreamResponse(traceEventsResponse.value, "runtime");
})
.catch((error) => {
log.error("log::runtime", `an error occured: ${displayError(error)}`);
log.error("log::runtime", `an error ocurred: ${displayError(error)}`);
});
}, 2_000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("PropertyGrid", () => {
});

test("renders properly with an error", () => {
currentResource.error.set("Ooops, an error occured");
currentResource.error.set("Ooops, an error occurred");

const { container } = render(PropertyGrid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`PropertyGrid > renders properly with an error 1`] = `
<div
class="italic"
>
An error occured
An error occurred
</div>
</div>
</div>
Expand Down
Loading