Skip to content

Commit

Permalink
feat(trip-planner): Enhance error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jmacura committed Jun 12, 2024
1 parent 917d3bc commit 85e9fe5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions projects/hslayers/assets/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@
"TRIP_PLANNER": {
"clearWaypoints": "Vyčistit body trasy",
"missingAuth": "Přístup k navigační službě nepovolen",
"noRoutablePoint": "Nebyl nalezen směrovatelný bod trasy",
"removeWaypoint": "Odebrat bod trasy",
"routerLayer": "Vrstva s trasou",
"serviceDown": "Navigační služba zdá se nefunguje. Je nám líto!",
Expand Down
1 change: 1 addition & 0 deletions projects/hslayers/assets/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@
"TRIP_PLANNER": {
"clearWaypoints": "Clear waypoints",
"missingAuth": "Routing service not authorized",
"noRoutablePoint": "No routable point found",
"removeWaypoint": "Remove waypoint",
"routerLayer": "Route layer",
"serviceDown": "Navigation service seems to be down. We are sorry!",
Expand Down
17 changes: 12 additions & 5 deletions projects/hslayers/components/trip-planner/trip-planner.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,23 @@ export class HsTripPlannerService {
undefined,
);
if (e.status == 404) {
title = this.HsLanguageService.getTranslation(
'TRIP_PLANNER.missingAuth',
undefined,
);
if (e.error?.error?.code == 2010) {
title = this.HsLanguageService.getTranslation(
'TRIP_PLANNER.noRoutablePoint',
undefined,
);
} else {
title = this.HsLanguageService.getTranslation(
'TRIP_PLANNER.missingAuth',
undefined,
);
}
}
this.HsToastService.createToastPopupMessage(
title,
this.HsLanguageService.getTranslationIgnoreNonExisting(
'ERRORMESSAGES',
e.message,
e.error?.error?.message ?? e.message,
{url},
),
{
Expand Down

0 comments on commit 85e9fe5

Please sign in to comment.