Adding new middleware and using it for test action workflow (#6017)

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
alannncandPeer Richelsen authored and GitHub committed 2022-12-13 21:34:21 +00:00
1 parent 9eb52bbfb2
commit 1f4e7ca695
3 files changed
+45 -6

No files matched your search

@@ -12,7 +12,7 @@ import "react-phone-number-input/style.css";
import { SENDER_ID } from "@calcom/lib/constants";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { HttpError } from "@calcom/lib/http-error";
import { trpc } from "@calcom/trpc/react";
import { trpc, TRPCClientError } from "@calcom/trpc/react";
import {
Button,
Checkbox,
@@ -134,10 +134,16 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
showToast(t("notification_sent"), "success");
},
onError: (err) => {
if (err instanceof HttpError) {
const message = `${err.statusCode}: ${err.message}`;
showToast(message, "error");
let message = t("unexpected_error_try_again");
if (err instanceof TRPCClientError) {
if (err.message === "rate-limit-exceeded") {
message = t("rate_limit_exceeded");
}
}
if (err instanceof HttpError) {
message = `${err.statusCode}: ${err.message}`;
}
showToast(message, "error");
},
});