diff --git a/packages/lib/survey/service.ts b/packages/lib/survey/service.ts index 96e303675b..64bcb43e53 100644 --- a/packages/lib/survey/service.ts +++ b/packages/lib/survey/service.ts @@ -107,10 +107,8 @@ export const getSurveyWithAnalytics = async (surveyId: string): Promise => { 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 => { 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 => { } 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 { 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"); }