Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add page error log #636

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions apps/nestjs-backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@
"keyv": "4.5.4",
"knex": "3.1.0",
"lodash": "4.17.21",
"markdown-it": "14.1.0",
"markdown-it-sanitizer": "0.4.3",
"mime-types": "2.1.35",
"minio": "7.1.3",
"ms": "2.1.3",
Expand Down
25 changes: 15 additions & 10 deletions apps/nestjs-backend/src/features/mail-sender/mail-sender.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@ export class MailSenderService {
@BaseConfig() private readonly baseConfig: IBaseConfig
) {}

async sendMail(mailOptions: ISendMailOptions): Promise<boolean> {
return this.mailService
.sendMail(mailOptions)
.then(() => true)
.catch((reason) => {
if (reason) {
this.logger.error(`Mail sending failed: ${reason.message}`, reason.stack);
}
return false;
});
async sendMail(
mailOptions: ISendMailOptions,
extra?: { shouldThrow?: boolean }
): Promise<boolean> {
const sender = this.mailService.sendMail(mailOptions).then(() => true);
if (extra?.shouldThrow) {
return sender;
}

return sender.catch((reason) => {
if (reason) {
this.logger.error(`Mail sending failed: ${reason.message}`, reason.stack);
}
return false;
});
}

inviteEmailOptions(info: { name: string; email: string; spaceName: string; inviteUrl: string }) {
Expand Down
3 changes: 2 additions & 1 deletion apps/nextjs-app/src/pages/base/[baseId]/[tableId].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ export const getServerSideProps: GetServerSideProps = withAuthSSR(async (context
};
} catch (e) {
const error = e as IHttpError;
if (error.status !== 401) {
if (error.status < 500) {
return {
notFound: true,
};
}
console.error(error);
throw error;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,16 @@ export const getServerSideProps = withAuthSSR<IViewPageProps>(async (context, ss
};
}
return {
err: '',
notFound: true,
};
} catch (e) {
const error = e as IHttpError;
if (error.status !== 401) {
if (error.status < 500) {
return {
err: '',
notFound: true,
};
}
console.error(error);
throw error;
}
});
Expand Down
5 changes: 2 additions & 3 deletions apps/nextjs-app/src/pages/base/[baseId]/[tableId]/design.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ export const getServerSideProps = withAuthSSR<IDesignPageProps>(async (context,
};
}
return {
err: '',
notFound: true,
};
} catch (e) {
const error = e as IHttpError;
if (error.status !== 401) {
if (error.status < 500) {
return {
err: '',
notFound: true,
};
}
console.error(error);
throw error;
}
});
Expand Down
31 changes: 0 additions & 31 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading