Skip to content

Commit

Permalink
ui: show backend error msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
traines-source committed Jan 18, 2025
1 parent 636154f commit e3760dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/src/lib/ErrorMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
} = $props();
</script>

<div class="m-4 text-red-600">{e}</div>
<div class="m-4 text-red-600"><div class="min-w-0">{e}</div></div>
3 changes: 2 additions & 1 deletion ui/src/lib/ItineraryList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
const throwOnError = (promise: RequestResult<PlanResponse, PlanError, false>) =>
promise.then((response) => {
if (response.error) throw new Error(String(response.error));
console.log(response.error);
if (response.error) throw new Error(String((response.error as any).error ?? response.error));
return response.data!;
});
</script>
Expand Down
3 changes: 2 additions & 1 deletion ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@
const onClickTrip = async (tripId: string, replace: boolean = false) => {
const { data: itinerary, error } = await trip({ query: { tripId } });
if (error) {
alert(error);
console.log(error);
alert(String((error as any).error ?? error));
return;
}
pushStateWithQueryString({ tripId }, { selectedItinerary: itinerary, tripId: tripId }, replace);
Expand Down

0 comments on commit e3760dd

Please sign in to comment.