mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-22 21:48:45 -05:00
fix: adds try...catch in all services (#2494)
Co-authored-by: Matti Nannt <mail@matthiasnannt.com>
This commit is contained in:
@@ -8,12 +8,17 @@ export const sendFreeLimitReachedEventToPosthogBiWeekly = async (
|
||||
): Promise<string> =>
|
||||
unstable_cache(
|
||||
async () => {
|
||||
await capturePosthogEnvironmentEvent(environmentId, "free limit reached", {
|
||||
plan,
|
||||
});
|
||||
return "success";
|
||||
try {
|
||||
await capturePosthogEnvironmentEvent(environmentId, "free limit reached", {
|
||||
plan,
|
||||
});
|
||||
return "success";
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
[`posthog-${plan}-limitReached-${environmentId}`],
|
||||
[`sendFreeLimitReachedEventToPosthogBiWeekly-${plan}-${environmentId}`],
|
||||
{
|
||||
revalidate: 60 * 60 * 24 * 15, // 15 days
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ export async function POST(request: Request) {
|
||||
|
||||
return Response.json(user);
|
||||
} catch (e) {
|
||||
if (e.code === "P2002") {
|
||||
if (e.message === "User with this email already exists") {
|
||||
return Response.json(
|
||||
{
|
||||
error: "user with this email address already exists",
|
||||
|
||||
Reference in New Issue
Block a user