From 521f562e68944d4197e085cab7d7aa455cd44774 Mon Sep 17 00:00:00 2001 From: Kyler Chin <7539174+kylerchin@users.noreply.github.com> Date: Sun, 17 Nov 2024 00:43:36 -0800 Subject: [PATCH] error messages --- package-lock.json | 54 ++++++++++++++++++++++++++++ package.json | 1 + src/components/SingleTripInfo.svelte | 18 +++++++++- yarn.lock | 24 +++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 2299931..3cc16dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "maplibre-gl": "5.0.0-pre.5", "moment": "^2.30.1", "protobufjs": "^7.4.0", + "stringify-object": "^5.0.0", "svelte-i18n": "^4.0.1", "svelte-toasts": "^1.1.2", "toastify-js": "^1.12.0", @@ -3248,6 +3249,18 @@ "node": "*" } }, + "node_modules/get-own-enumerable-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-own-enumerable-keys/-/get-own-enumerable-keys-1.0.0.tgz", + "integrity": "sha512-PKsK2FSrQCyxcGHsGrLDcK0lx+0Ke+6e8KFFozA9/fIQLhQzPaRvJFdcz7+Axg3jUH/Mq+NI4xa5u/UT2tQskA==", + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/get-source": { "version": "2.0.12", "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz", @@ -3726,6 +3739,18 @@ "node": ">=0.12.0" } }, + "node_modules/is-obj": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-3.0.0.tgz", + "integrity": "sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-path-inside": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", @@ -3760,6 +3785,18 @@ "@types/estree": "*" } }, + "node_modules/is-regexp": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-3.1.0.tgz", + "integrity": "sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz", @@ -6220,6 +6257,23 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "node_modules/stringify-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-5.0.0.tgz", + "integrity": "sha512-zaJYxz2FtcMb4f+g60KsRNFOpVMUyuJgA51Zi5Z1DOTC3S59+OQiVOzE9GZt0x72uBGWKsQIuBKeF9iusmKFsg==", + "license": "BSD-2-Clause", + "dependencies": { + "get-own-enumerable-keys": "^1.0.0", + "is-obj": "^3.0.0", + "is-regexp": "^3.1.0" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/yeoman/stringify-object?sponsor=1" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", diff --git a/package.json b/package.json index 3123d6f..c518696 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "maplibre-gl": "5.0.0-pre.5", "moment": "^2.30.1", "protobufjs": "^7.4.0", + "stringify-object": "^5.0.0", "svelte-i18n": "^4.0.1", "svelte-toasts": "^1.1.2", "toastify-js": "^1.12.0", diff --git a/src/components/SingleTripInfo.svelte b/src/components/SingleTripInfo.svelte index d2f2a9d..bc20a46 100644 --- a/src/components/SingleTripInfo.svelte +++ b/src/components/SingleTripInfo.svelte @@ -11,6 +11,7 @@ import TimeDiff from './TimeDiff.svelte'; import polyline from '@mapbox/polyline'; import AlertBox from './serviceAlerts.svelte'; + import stringifyObject from 'stringify-object'; import { writable, get } from 'svelte/store'; import { fixHeadsignIcon, @@ -428,6 +429,10 @@ console.log('refresh component'); } catch (e: any) { error = text; + console.log(stringifyObject(trip_selected, { + indent: ' ', + singleQuotes: false + })) } }) .catch((e) => { @@ -500,7 +505,18 @@
{#if error != null} - {error} +
+

Error from server:

+

{error}

+

Request made:

+

+ {@html stringifyObject(trip_selected, { + indent: '\t', + singleQuotes: false + }).replaceAll("\n", "
")} +

+

Report this error to the Catenary Discord server: https://discord.gg/w4Kd5Gj3re

+
{:else if is_loading_trip_data} {#each [0, 1, 2, 3, 4, 5, 6, 7, 8] as it}
diff --git a/yarn.lock b/yarn.lock index 948d0b6..022c735 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1759,6 +1759,11 @@ get-func-name@^2.0.1, get-func-name@^2.0.2: resolved "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz" integrity sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ== +get-own-enumerable-keys@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/get-own-enumerable-keys/-/get-own-enumerable-keys-1.0.0.tgz" + integrity sha512-PKsK2FSrQCyxcGHsGrLDcK0lx+0Ke+6e8KFFozA9/fIQLhQzPaRvJFdcz7+Axg3jUH/Mq+NI4xa5u/UT2tQskA== + get-source@^2.0.12: version "2.0.12" resolved "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz" @@ -2040,6 +2045,11 @@ is-number@^7.0.0: resolved "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-obj@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/is-obj/-/is-obj-3.0.0.tgz" + integrity sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ== + is-path-inside@^3.0.3: version "3.0.3" resolved "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz" @@ -2069,6 +2079,11 @@ is-reference@1.2.1: dependencies: "@types/estree" "*" +is-regexp@^3.1.0: + version "3.1.0" + resolved "https://registry.npmjs.org/is-regexp/-/is-regexp-3.1.0.tgz" + integrity sha512-rbku49cWloU5bSMI+zaRaXdQHXnthP6DZ/vLnfdSKyL4zUzuWnomtOEiZZOd+ioQ+avFo/qau3KPTc7Fjy1uPA== + is-stream@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz" @@ -3435,6 +3450,15 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" +stringify-object@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/stringify-object/-/stringify-object-5.0.0.tgz" + integrity sha512-zaJYxz2FtcMb4f+g60KsRNFOpVMUyuJgA51Zi5Z1DOTC3S59+OQiVOzE9GZt0x72uBGWKsQIuBKeF9iusmKFsg== + dependencies: + get-own-enumerable-keys "^1.0.0" + is-obj "^3.0.0" + is-regexp "^3.1.0" + "strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"