Skip to content

Commit 33d4f57

Browse files
authored
Merge pull request #3112 from Dokploy/Email-test-notification-always-successful.-#2841
refactor: improve error handling in notification components
2 parents 5574874 + bacadcc commit 33d4f57

File tree

8 files changed

+1053
-1026
lines changed

8 files changed

+1053
-1026
lines changed

apps/dokploy/components/dashboard/settings/notifications/handle-notifications.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,8 +1261,10 @@ export const HandleNotifications = ({ notificationId }: Props) => {
12611261
});
12621262
}
12631263
toast.success("Connection Success");
1264-
} catch {
1265-
toast.error("Error testing the provider");
1264+
} catch (error) {
1265+
toast.error(
1266+
`Error testing the provider ${error instanceof Error ? error.message : "Unknown error"}`,
1267+
);
12661268
}
12671269
}}
12681270
>

apps/dokploy/server/api/routers/notification.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const notificationRouter = createTRPCRouter({
111111
} catch (error) {
112112
throw new TRPCError({
113113
code: "BAD_REQUEST",
114-
message: "Error testing the notification",
114+
message: `${error instanceof Error ? error.message : "Unknown error"}`,
115115
cause: error,
116116
});
117117
}
@@ -228,7 +228,7 @@ export const notificationRouter = createTRPCRouter({
228228
} catch (error) {
229229
throw new TRPCError({
230230
code: "BAD_REQUEST",
231-
message: "Error testing the notification",
231+
message: `${error instanceof Error ? error.message : "Unknown error"}`,
232232
cause: error,
233233
});
234234
}
@@ -285,7 +285,7 @@ export const notificationRouter = createTRPCRouter({
285285
} catch (error) {
286286
throw new TRPCError({
287287
code: "BAD_REQUEST",
288-
message: "Error testing the notification",
288+
message: `${error instanceof Error ? error.message : "Unknown error"}`,
289289
cause: error,
290290
});
291291
}

0 commit comments

Comments
 (0)