LinkedErrors for Cordova
Allows you to configure linked errors. (default)
Class name: Sentry.BrowserIntegrations.LinkedErrors
This integration is enabled by default. If you'd like to modify your default integrations, read this.
This integration allows you to configure linked errors. They'll be recursively read up to a specified limit, then lookup will be performed by a specific key. By default, the Sentry SDK sets the limit to five and the key used is "cause".
Copied
Sentry.init({
integrations: [new Sentry.BrowserIntegrations.LinkedErrors()],
});
Sentry.init({
integrations: [new Sentry.BrowserIntegrations.LinkedErrors()],
});
Type: string
The key on the error object that points to the linked error. Defaults to "cause".
Type: number
The maximum number of linked errors to read. Defaults to 5.
Here's a code example of how this could be implemented:
Copied
document
.querySelector("#get-reviews-btn")
.addEventListener("click", async (event) => {
const movie = event.target.dataset.title;
try {
const reviews = await fetchMovieReviews(movie);
renderMovieReviews(reviews);
} catch (e) {
const fetchError = new Error(
`Failed to fetch reviews for: ${movie}`,
);
fetchError.cause = e;
Sentry.captureException(fetchError);
renderMovieReviewsError(fetchError);
}
});
document
.querySelector("#get-reviews-btn")
.addEventListener("click", async (event) => {
const movie = event.target.dataset.title;
try {
const reviews = await fetchMovieReviews(movie);
renderMovieReviews(reviews);
} catch (e) {
const fetchError = new Error(
`Failed to fetch reviews for: ${movie}`,
);
fetchError.cause = e;
Sentry.captureException(fetchError);
renderMovieReviewsError(fetchError);
}
});
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").