-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
docs(js): Review and update Nest.js Quick Start guide #13497
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
@@ -33,28 +33,15 @@ import { AppService } from "./app.service"; | |||
export class AppModule {} | |||
``` | |||
|
|||
If you're using a global catch-all exception filter (which is either a filter registered with `app.useGlobalFilters()` or a filter registered in your app module providers annotated with a `@Catch()` decorator without arguments), add a `@SentryExceptionCaptured()` decorator to the filter's `catch()` method. | |||
This decorator will report all unexpected errors that are received by your global error filter to Sentry: | |||
By default, only unhandled exceptions that are not caught by an error filter are reported to Sentry. Additionally, `HttpException`s (including [derivatives](https://docs.nestjs.com/exception-filters#built-in-http-exceptions)) are not captured automatically as they mostly act as control flow vehicles. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we start with the Error Capturing topic.
I was wondering if it would make sense to not have this in "Apply Instrumentation to Your App" and instead put it in a dedicated section, "Step x: Capture Nest.js Errors" -> similar to how we have it for React .
But then this only seems to be documented for CJS - I was wondering why we don't have this documented for ESM? Or is this not needed/possible?
I don't see this as part of this PR -- we can address in a future issue/PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if it would make sense to not have this in "Apply Instrumentation to Your App" and instead put it in a dedicated section, "Step x: Capture Nest.js Errors"
This sounds reasonable to me!
But then this only seems to be documented for CJS - I was wondering why we don't have this documented for ESM? Or is this not needed/possible?
I think this should be the same for CJS and ESM. Or IOW, the filters require should be applied in the same way regardless of ESM/CJS
I don't see this as part of this PR -- we can address in a future issue/PR.
that also sounds reasonable :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good but I think we need to sort out some things:
- h: we can't include nestjs specific code and instructions in the shared commonjs page
- m: we should avoid linking to commonJS for the exception filter explanation (or IOW think about where we put this and then link there if applicable)
1 we need to solve in this PR, 2 we can also address in a follow-up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For NestJS-CommmonJS specifically, I don't think we should show ESM/CJS tabs here because later on we instruct users to import "./instrument"
. Since Nest ships with TS, we can simply let users create an instrument.ts
file. (cc @chargome - let me know if I'm missing something or this sounds unreasonable to you)
I'm realizing that this is a common guide for various node platforms but it's quite confusing for NestJS I'd argue. So maybe it makes sense to create a Nest-specific version of it 🤔 In general, for the common guide, I don't think we should even show the ESM tab on the CommonJS installation page :)
also please see my other comment about nestjs-specific code in this page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sounds reasonable to just use a ts file here 👍
} | ||
} | ||
``` | ||
For more precise control over error reporting in global catch-all exception filters, specific exception filters, or microservices, check out our [CommonJS installation documentation](/platforms/javascript/guides/nestjs/install/commonjs/). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m: I don't think we should link to the CJS guide for this. Either we find a place for it here, or we do something like we have in Angular or React where we explain the intricacies of the filters in a "NestJS Features -> Exception Filters" page. wdyt?
…ick-start/review-nestjs
Bundle ReportChanges will increase total bundle size by 240 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
view changes for bundle: sentry-docs-client-array-pushAssets Changed:
|
Thanks @Lms24 !
I restored the previous content of the commonjs and getting-started-use/nestjs pages. So, now the Nest.js specific info shouldn't surface on other platforms anymore -- lmk if I missed something 🙏 (I think this is the most complex structure I've worked with so far :D) This way, we can keep this PR focused and small and tackle other issues in a new PR. -> I already created an issue here #13525 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes and for creating the follow-up issue.
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
New updates in this PR, @chargome @Lms24
|
|
||
To make sure Sentry captures all your app's errors, configure error handling based on how your application manages exceptions: | ||
|
||
### Using a Global Catch-All Exception Filter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This I would rather name something like "using a custom global filter" – and update the section below accordingly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the subheading to
Using a Custom Global Filter
and
Not Using a Custom Global Filter
@@ -14,9 +16,9 @@ async function bootstrap() { | |||
bootstrap(); | |||
``` | |||
|
|||
Afterwards, add the `SentryModule` as a root module to your main module: | |||
Afterward, add the `SentryModule` as a root module to your main module: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afterward, add the `SentryModule` as a root module to your main module: | |
Afterwards, add the `SentryModule` as a root module to your main module: |
I think? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both forms are correct, although the variant with “s” is used in British English and the one without in American English 👍
…ick-start/review-nestjs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@inventarSarah just realized that we have the global error filter sections now twice in the guide!
…ick-start/review-nestjs
Fixed -> things got crazy with the includes! Quick Start guide and CommonJS installation method page (which used the same includes) look okay to me now |
seems to be stuck, can you re-trigger a deployment? |
…ick-start/review-nestjs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good from my end, will let @chargome give the final approval :)
DESCRIBE YOUR PR
The Nest.js quick start guide already looked great -> I added and removed some content to be more consistent with our other guides.
I tried to streamline the CommonJS section, as we already have the details on this page (I added a link to the page). Plus, the content seemed too detailed for a Quick Start guide IMO.
Naturally, if you say the info I removed is vital for the QS guide, we can add it back in.
Additionally, I expanded the "Verify Your Setup" section so the example provided is like our Node.js one.
Closes: #13498
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
EXTRA RESOURCES