Skip to content

Commit 005ce9a

Browse files
Lms24lizokm
andcommitted
Apply suggestions from code review
Co-authored-by: Liza Mock <[email protected]>
1 parent 8ab8a2d commit 005ce9a

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

docs/platforms/javascript/guides/angular/features/error-handler.mdx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ title: Angular Error Handler
33
description: "Learn about Sentry's Angular SDK Error Handler and how to configure it."
44
---
55

6-
Sentry's Angular SDK provides a custom Angular `ErrorHandler` that automatically extracts and captures errors in your Angular application. The main benefit is that Angular often wraps errors in its own error classes, making
7-
it hard for Sentry to extract the important data correctly without a custom error handler.
8-
9-
On this page, you'll learn how to work with the the SDKs `ErrorHandler` if you need to customize it further.
6+
Angular often wraps errors in its own error classes, making it hard for Sentry to extract the important data correctly without a custom error handler, which is where Sentry's Angular SDK `ErrorHandler` can help. On this page, you'll learn how to customize the SDK's `ErrorHandler` to work for your use case.
107

118
## Using the Sentry `ErrorHandler`
129

13-
Simply register the Sentry `ErrorHandler` in your Angular application's providers. We recommend to do this in your main `app.config.ts` or `app.module.ts` file to ensure that the `ErrorHandler` is available everywhere in your application.
10+
To get started, register the Sentry `ErrorHandler` in your Angular application's providers. We recommend to do this in your main `app.config.ts` or `app.module.ts` file to ensure that the `ErrorHandler` is available everywhere in your application.
1411

1512
```typescript {tabTitle:App Config} {filename:app.config.ts} {3,8-11}
1613
import { ApplicationConfig, ErrorHandler } from "@angular/core";
@@ -48,24 +45,24 @@ export class AppModule {}
4845

4946
### Options
5047

51-
Optionally, you can configure the behavior of the `ErrorHandler` by passing an object to the `createErrorHandler` function. The following options are available:
48+
As an alternative, you can configure the behavior of the `ErrorHandler` by passing an object to the `createErrorHandler` function. The following options are available:
5249

5350
#### `logErrors`
5451

5552
_Type: `boolean` Default: `true`_
5653

57-
Log errors to the console. This is `true` by default, to ensure consistency with Angular's default behavior.
54+
Lets you log errors to the console. This is `true` by default to ensure consistency with Angular's default behavior.
5855

5956
#### `extractor`
6057

6158
_Type: `function` Default: `undefined`_
6259

63-
A function that extracts the raw, incoming error object. By default, the SDK uses its own extraction logic but you can override it by providing your own function.
60+
Lets you extract the raw, incoming error object. The SDK uses its own extraction logic by default, but you can override it by providing your own function.
6461

6562
## Multiple Error Handlers
6663

67-
Angular doesn't allow providing multiple `ErrorHandler` instances in the same Angular application in `app.config.ts` or `app.module.ts`.
68-
Therefore, if you're using your own error handler or you want to add additional logic to Sentry's `ErrorHandler`, extend Sentry's `ErrorHandler`:
64+
Angular doesn't let you provide multiple `ErrorHandler` instances in the same Angular application in `app.config.ts` or `app.module.ts`.
65+
Therefore, if you're using your own error handler or you want to add additional logic to Sentry's `ErrorHandler`, you have to extend Sentry's `ErrorHandler` like in the example below:
6966

7067
```typescript
7168
import * as Sentry from "@sentry/angular";

platform-includes/getting-started-config/javascript.angular.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ import * as Sentry from "@sentry/angular";
7171
export class AppModule {}
7272
```
7373

74-
The `Sentry.createErrorHandler` function initializes a Sentry-specific `ErrorHandler` that automatically sends errors caught by Angular to Sentry. Cou can further [configure](./features/error-handler) Sentry's `ErrorHandler` behavior.
74+
The `Sentry.createErrorHandler` function initializes a Sentry-specific `ErrorHandler` that automatically sends errors caught by Angular to Sentry. Learn how to further configure Sentry's `ErrorHandler` behavior [here](./features/error-handler).
7575

7676
<OnboardingOption optionId="performance">
7777
The `Sentry.TraceService` listens to the Angular router for tracing. To inject `TraceService`, register the `APP_INITIALIZER` provider as shown above. Alternatively, you can also require the `TraceService` from inside your `AppModule` constructor:

0 commit comments

Comments
 (0)