From 8b38b2f423aa415430825192628c08359bad884c Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 1 Mar 2023 07:51:30 -0500 Subject: [PATCH] Update frontend to handle errors --- web-frontend/src/lib/common.js | 5 ++++ web-frontend/src/routes/+page.svelte | 45 ++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 web-frontend/src/lib/common.js diff --git a/web-frontend/src/lib/common.js b/web-frontend/src/lib/common.js new file mode 100644 index 0000000..2694b7d --- /dev/null +++ b/web-frontend/src/lib/common.js @@ -0,0 +1,5 @@ +export const WasmStatus = { + NotLoaded: 0, + Loaded: 1, + Errored: 2 +}; diff --git a/web-frontend/src/routes/+page.svelte b/web-frontend/src/routes/+page.svelte index 15c7aad..8c87444 100644 --- a/web-frontend/src/routes/+page.svelte +++ b/web-frontend/src/routes/+page.svelte @@ -1,4 +1,5 @@ -

Welcome to SvelteKit

+

Encoding

-

Current cursor: {addr} => ({latlng.lat}, {latlng.lng})

+{#if wasmStatus == WasmStatus.Loaded || wasmStatus == WasmStatus.NotLoaded} +

Current cursor: {addr} => ({latlng.lat}, {latlng.lng})

-
-
-
+
+
+
+{:else if wasmStatus == WasmStatus.Errored} +
+
+ +
+
+

Error

+

Error: {wasmError}.

+
+
+{/if}