Skip to content

Commit f0a45ab

Browse files
committed
temp fix for server action error obfuscated in prod
1 parent 5425bea commit f0a45ab

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

components/form/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,12 @@ export default function Form({
5656
}
5757
toast.success(`Successfully updated ${inputAttrs.name}!`);
5858
})
59-
.catch((err: Error) => toast.error(err.message));
59+
.catch((err: Error) => {
60+
console.log(err);
61+
// ideally we'd wanna log the actual error, but for some reason
62+
// server action errors are obfuscated in prod
63+
toast.error(`This ${inputAttrs.name} is already in use.`);
64+
});
6065
}}
6166
className="rounded-lg border border-stone-200 bg-white"
6267
>

components/modal/create-site.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ export default function CreateSiteModal() {
2424
modal?.hide();
2525
toast.success(`Successfully created site!`);
2626
})
27-
.catch((err: Error) => toast.error(err.message))
27+
.catch((err: Error) => {
28+
console.log(err);
29+
// ideally we'd wanna log the actual error, but for some reason
30+
// server action errors are obfuscated in prod
31+
toast.error(`This subdomain is already in use.`);
32+
})
2833
}
2934
className="w-full rounded-md bg-white md:max-w-md md:border md:border-stone-200 md:shadow"
3035
>

0 commit comments

Comments
 (0)