mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-04 13:35:22 +02:00
Refactor ShowSchedules component and enhance error handling in schedule API
- Simplified the mutation calls in the ShowSchedules component by removing success callbacks, streamlining the code. - Improved the display logic to conditionally render the HandleSchedules component when schedules are present. - Enhanced error handling in the runManually mutation within the schedule API, ensuring proper logging and error messaging for better debugging.
This commit is contained in:
@@ -95,8 +95,16 @@ export const scheduleRouter = createTRPCRouter({
|
||||
runManually: protectedProcedure
|
||||
.input(z.object({ scheduleId: z.string().min(1) }))
|
||||
.mutation(async ({ input }) => {
|
||||
await runCommand(input.scheduleId);
|
||||
|
||||
return true;
|
||||
try {
|
||||
await runCommand(input.scheduleId);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
throw new TRPCError({
|
||||
code: "INTERNAL_SERVER_ERROR",
|
||||
message:
|
||||
error instanceof Error ? error.message : "Error running schedule",
|
||||
});
|
||||
}
|
||||
}),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user