From 90e3cc66009df492535c3e61b58999231486ec77 Mon Sep 17 00:00:00 2001 From: Brandon Sprague Date: Fri, 17 Nov 2023 13:49:08 -0800 Subject: [PATCH] Serialize errors we encounter This PR makes it so that we serialize errors if we're going to send them across the SSR boundary. The problem this fixes is that some errors (like Nuxt reporting composable usage outside a `setup` function) have functions and other non-POJO/non-serializable info with them, which makes our `useState` implode, ironically hiding the original error. This introduces a new non-dev dependency (which I don't do lightly) on `serialize-error`, a small (<1kB min + gzip'd) and popular dependency for doing the surprisingly nontrivial task of serializing different types of errors and preserving type information. --- frontend/app.vue | 4 +++- frontend/components/modal/Error.vue | 4 +++- frontend/composables/useModal.ts | 3 ++- frontend/package-lock.json | 27 ++++++++++++++++++++++++--- frontend/package.json | 1 + 5 files changed, 33 insertions(+), 6 deletions(-) diff --git a/frontend/app.vue b/frontend/app.vue index 1eea4dd..f8d4c74 100644 --- a/frontend/app.vue +++ b/frontend/app.vue @@ -1,8 +1,10 @@