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 @@
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
+