fix: error message from backend

This commit is contained in:
Nicolas Meienberger
2025-09-27 12:00:32 +02:00
parent ca7c6c7ecf
commit 9f3fb8a302
4 changed files with 13 additions and 7 deletions

View File

@@ -26,6 +26,9 @@ export const HealthchecksCard = ({ volume }: Props) => {
} }
toast.success("Health check completed", { description: "The volume is healthy." }); toast.success("Health check completed", { description: "The volume is healthy." });
}, },
onError: (error) => {
toast.error("Health check failed", { description: error.message });
},
}); });
const toggleAutoRemount = useMutation({ const toggleAutoRemount = useMutation({
@@ -35,6 +38,9 @@ export const HealthchecksCard = ({ volume }: Props) => {
description: `Auto remount is now ${d.volume.autoRemount ? "enabled" : "paused"}.`, description: `Auto remount is now ${d.volume.autoRemount ? "enabled" : "paused"}.`,
}); });
}, },
onError: (error) => {
toast.error("Update failed", { description: error.message });
},
}); });
return ( return (

View File

@@ -1,11 +1,11 @@
import { useQuery } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query";
import { Unplug } from "lucide-react";
import * as YML from "yaml"; import * as YML from "yaml";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "~/components/ui/card";
import { CodeBlock } from "~/components/ui/code-block"; import { CodeBlock } from "~/components/ui/code-block";
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/components/ui/table"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "~/components/ui/table";
import type { Volume } from "~/lib/types"; import type { Volume } from "~/lib/types";
import { getContainersUsingVolumeOptions } from "../../../api-client/@tanstack/react-query.gen"; import { getContainersUsingVolumeOptions } from "../../../api-client/@tanstack/react-query.gen";
import { Unplug } from "lucide-react";
type Props = { type Props = {
volume: Volume; volume: Volume;
@@ -49,7 +49,7 @@ export const DockerTabContent = ({ volume }: Props) => {
<Card> <Card>
<CardHeader> <CardHeader>
<CardTitle>Plug-and-play Docker integration</CardTitle> <CardTitle>Plug-and-play Docker integration</CardTitle>
<CardDescription className="mt-2"> <CardDescription>
This volume can be used in your Docker Compose files by referencing it as an external volume. The example This volume can be used in your Docker Compose files by referencing it as an external volume. The example
demonstrates how to mount the volume to a service (nginx in this case). Make sure to adjust the path inside demonstrates how to mount the volume to a service (nginx in this case). Make sure to adjust the path inside
the container to fit your application's needs the container to fit your application's needs

View File

@@ -5,10 +5,10 @@ import { logger as honoLogger } from "hono/logger";
import { openAPISpecs } from "hono-openapi"; import { openAPISpecs } from "hono-openapi";
import { runDbMigrations } from "./db/db"; import { runDbMigrations } from "./db/db";
import { driverController } from "./modules/driver/driver.controller"; import { driverController } from "./modules/driver/driver.controller";
import { volumeController } from "./modules/volumes/volume.controller";
import { logger } from "./utils/logger";
import { startup } from "./modules/lifecycle/startup"; import { startup } from "./modules/lifecycle/startup";
import { volumeController } from "./modules/volumes/volume.controller";
import { handleServiceError } from "./utils/errors"; import { handleServiceError } from "./utils/errors";
import { logger } from "./utils/logger";
export const generalDescriptor = (app: Hono) => export const generalDescriptor = (app: Hono) =>
openAPISpecs(app, { openAPISpecs(app, {
@@ -51,7 +51,7 @@ app.onError((err, c) => {
const { status, message } = handleServiceError(err); const { status, message } = handleServiceError(err);
return c.json({ error: message }, status); return c.json({ message }, status);
}); });
const socketPath = "/run/docker/plugins/ironmount.sock"; const socketPath = "/run/docker/plugins/ironmount.sock";

View File

@@ -7,17 +7,17 @@ import {
type GetVolumeResponseDto, type GetVolumeResponseDto,
getContainersDto, getContainersDto,
getVolumeDto, getVolumeDto,
healthCheckDto,
type ListContainersResponseDto, type ListContainersResponseDto,
type ListVolumesResponseDto, type ListVolumesResponseDto,
listVolumesDto, listVolumesDto,
mountVolumeDto, mountVolumeDto,
testConnectionBody, testConnectionBody,
testConnectionDto, testConnectionDto,
type UpdateVolumeResponseDto,
unmountVolumeDto, unmountVolumeDto,
updateVolumeBody, updateVolumeBody,
updateVolumeDto, updateVolumeDto,
healthCheckDto,
type UpdateVolumeResponseDto,
} from "./volume.dto"; } from "./volume.dto";
import { volumeService } from "./volume.service"; import { volumeService } from "./volume.service";