mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-25 03:09:24 -06:00
chore: improve logging in survey service (#1156)
This commit is contained in:
@@ -107,10 +107,8 @@ export const getSurveyWithAnalytics = async (surveyId: string): Promise<TSurveyW
|
||||
select: selectSurveyWithAnalytics,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
console.error(error.message);
|
||||
throw new DatabaseError("Database operation failed");
|
||||
}
|
||||
|
||||
@@ -186,10 +184,8 @@ export const getSurvey = async (surveyId: string): Promise<TSurvey | null> => {
|
||||
select: selectSurvey,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
console.error(error.message);
|
||||
throw new DatabaseError("Database operation failed");
|
||||
}
|
||||
|
||||
@@ -322,10 +318,8 @@ export const getSurveys = async (environmentId: string): Promise<TSurvey[]> => {
|
||||
select: selectSurvey,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
console.error(error.message);
|
||||
throw new DatabaseError("Database operation failed");
|
||||
}
|
||||
|
||||
@@ -345,9 +339,6 @@ export const getSurveys = async (environmentId: string): Promise<TSurvey[]> => {
|
||||
}
|
||||
return surveys;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof z.ZodError) {
|
||||
console.error(JSON.stringify(error.errors, null, 2)); // log the detailed error information
|
||||
}
|
||||
@@ -383,10 +374,8 @@ export const getSurveysWithAnalytics = async (environmentId: string): Promise<TS
|
||||
select: selectSurveyWithAnalytics,
|
||||
});
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
console.error(error.message);
|
||||
throw new DatabaseError("Database operation failed");
|
||||
}
|
||||
|
||||
@@ -622,10 +611,8 @@ export async function updateSurvey(updatedSurvey: TSurvey): Promise<TSurvey> {
|
||||
|
||||
return modifiedSurvey;
|
||||
} catch (error) {
|
||||
if (error instanceof Error) {
|
||||
console.error(error.message);
|
||||
}
|
||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
||||
console.error(error.message);
|
||||
throw new DatabaseError("Database operation failed");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user