diff --git a/client/package.json b/client/package.json index 2128c396..f4e35cb7 100644 --- a/client/package.json +++ b/client/package.json @@ -33,6 +33,7 @@ }, "dependencies": { "facilmap-types": "workspace:^", + "serialize-error": "^11.0.3", "socket.io-client": "^4.7.4" }, "devDependencies": { diff --git a/client/src/client.ts b/client/src/client.ts index 263ccf27..ab25fb4a 100644 --- a/client/src/client.ts +++ b/client/src/client.ts @@ -1,5 +1,6 @@ import { io, type ManagerOptions, type Socket as SocketIO, type SocketOptions } from "socket.io-client"; -import type { Bbox, BboxWithZoom, CRU, EventHandler, EventName, FindOnMapQuery, FindPadsQuery, FindPadsResult, FindQuery, GetPadQuery, HistoryEntry, ID, Line, LineExportRequest, LineTemplateRequest, LineToRouteCreate, SocketEvents, Marker, MultipleEvents, ObjectWithId, PadData, PadId, PagedResults, SocketRequest, SocketRequestName, SocketResponse, Route, RouteClear, RouteCreate, RouteExportRequest, RouteInfo, RouteRequest, SearchResult, SocketVersion, TrackPoint, Type, View, Writable, SocketClientToServerEvents, SocketServerToClientEvents, LineTemplate, LinePointsEvent } from "facilmap-types"; +import { type Bbox, type BboxWithZoom, type CRU, type EventHandler, type EventName, type FindOnMapQuery, type FindPadsQuery, type FindPadsResult, type FindQuery, type GetPadQuery, type HistoryEntry, type ID, type Line, type LineExportRequest, type LineTemplateRequest, type LineToRouteCreate, type SocketEvents, type Marker, type MultipleEvents, type ObjectWithId, type PadData, type PadId, type PagedResults, type SocketRequest, type SocketRequestName, type SocketResponse, type Route, type RouteClear, type RouteCreate, type RouteExportRequest, type RouteInfo, type RouteRequest, type SearchResult, type SocketVersion, type TrackPoint, type Type, type View, type Writable, type SocketClientToServerEvents, type SocketServerToClientEvents, type LineTemplate, type LinePointsEvent, PadNotFoundError } from "facilmap-types"; +import { deserializeError, errorConstructors } from "serialize-error"; export interface ClientEvents extends SocketEvents { connect: []; @@ -65,6 +66,8 @@ interface ClientData { routes: Record; } +errorConstructors.set("PadNotFoundError", PadNotFoundError as any); + export default class Client { private socket: SocketIO, SocketClientToServerEvents>; private state: ClientState; @@ -192,9 +195,9 @@ export default class Client { this._simulateEvent("emit", eventName as any, data as any); return await new Promise((resolve, reject) => { - this.socket.emit(eventName as any, data, (err: Error, data: SocketResponse) => { + this.socket.emit(eventName as any, data, (err: any, data: SocketResponse) => { if(err) { - reject(err); + reject(deserializeError(err)); this._simulateEvent("emitReject", eventName as any, err); } else { const fixedData = this._fixResponseObject(eventName, data); diff --git a/frontend/src/i18n/de.ts b/frontend/src/i18n/de.ts index 14ff6b38..8a289d03 100644 --- a/frontend/src/i18n/de.ts +++ b/frontend/src/i18n/de.ts @@ -16,7 +16,7 @@ const messagesDe = { "map-data-pois": `POIs`, "map-data-directions": `Routenberechnung`, "map-data-geoip": `GeoIP`, - "map-data-geoip-description": `Dieses Produkt enthält GeoLine2-Daten von Maxmind, verfügbar unter {{maxmind}}.`, + "map-data-geoip-description": `Dieses Produkt enthält GeoLite2-Daten von Maxmind, verfügbar unter {{maxmind}}.`, "attribution-osm-contributors": `OSM-Mitwirkende`, "programs-libraries": `Programme/Bibliotheken`, "icons": `Symbole` diff --git a/frontend/src/lib/components/client-provider.vue b/frontend/src/lib/components/client-provider.vue index 5b526686..fd65b017 100644 --- a/frontend/src/lib/components/client-provider.vue +++ b/frontend/src/lib/components/client-provider.vue @@ -1,7 +1,7 @@ diff --git a/frontend/src/lib/components/line-info/line-info.vue b/frontend/src/lib/components/line-info/line-info.vue index ce02218c..fa096e50 100644 --- a/frontend/src/lib/components/line-info/line-info.vue +++ b/frontend/src/lib/components/line-info/line-info.vue @@ -7,7 +7,7 @@ import { getZoomDestinationForLine } from "../../utils/zoom"; import RouteForm from "../route-form/route-form.vue"; import vTooltip from "../../utils/tooltip"; - import { formatField, formatRouteTime, normalizeLineName, round } from "facilmap-utils"; + import { formatDistance, formatField, formatRouteTime, normalizeLineName } from "facilmap-utils"; import { computed, ref } from "vue"; import { useToasts } from "../ui/toasts/toasts.vue"; import { showConfirm } from "../ui/alert.vue"; @@ -160,7 +160,7 @@
Distance
-
{{round(line.distance, 2)}} km ({{formatRouteTime(line.time, line.mode)}})
+
{{formatDistance(line.distance)}} ({{formatRouteTime(line.time, line.mode)}})