Skip to content

Commit e704e99

Browse files
authored
error handling
fix: surface real EmailJS error instead of generic "something went wrong"
2 parents b16e789 + cb609d0 commit e704e99

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/pages/contact-us/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ const ContactUs: React.FC = () => {
4040
formRef.current.reset();
4141
} catch (err) {
4242
console.error("EmailJS send error:", err);
43+
const detail =
44+
err && typeof err === "object" && "text" in err
45+
? ` (${(err as { status?: number; text?: string }).status ?? ""}: ${(err as { text?: string }).text ?? ""})`
46+
: "";
4347
setErrorMessage(
44-
"Something went wrong. Please try again or email us directly at sanjay@recodehive.com.",
48+
`Something went wrong${detail}. Please try again or email us directly at sanjay@recodehive.com.`,
4549
);
4650
setStatus("error");
4751
}

0 commit comments

Comments
 (0)