Skip to content

fix(angular): export SentryErrorHandler #3438

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

Merged
merged 1 commit into from
Apr 22, 2021
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
8 changes: 4 additions & 4 deletions packages/angular/src/errorhandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface ErrorHandlerOptions {
*/
@Injectable({ providedIn: 'root' })
class SentryErrorHandler implements AngularErrorHandler {
private readonly _options: ErrorHandlerOptions;
protected readonly _options: ErrorHandlerOptions;

public constructor(options?: ErrorHandlerOptions) {
this._options = {
Expand Down Expand Up @@ -55,7 +55,7 @@ class SentryErrorHandler implements AngularErrorHandler {
/**
* Used to pull a desired value that will be used to capture an event out of the raw value captured by ErrorHandler.
*/
private _extractError(error: unknown): unknown {
protected _extractError(error: unknown): unknown {
// Allow custom overrides of extracting function
if (this._options.extractor) {
const defaultExtractor = this._defaultExtractor.bind(this);
Expand All @@ -68,7 +68,7 @@ class SentryErrorHandler implements AngularErrorHandler {
/**
* Default implementation of error extraction that handles default error wrapping, HTTP responses, ErrorEvent and few other known cases.
*/
private _defaultExtractor(errorCandidate: unknown): unknown {
protected _defaultExtractor(errorCandidate: unknown): unknown {
let error = errorCandidate;

// Try to unwrap zone.js error.
Expand Down Expand Up @@ -115,4 +115,4 @@ function createErrorHandler(config?: ErrorHandlerOptions): SentryErrorHandler {
return new SentryErrorHandler(config);
}

export { createErrorHandler };
export { createErrorHandler, SentryErrorHandler };
2 changes: 1 addition & 1 deletion packages/angular/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export * from '@sentry/browser';

export { init } from './sdk';
export { createErrorHandler, ErrorHandlerOptions } from './errorhandler';
export { createErrorHandler, ErrorHandlerOptions, SentryErrorHandler } from './errorhandler';
export {
getActiveTransaction,
// TODO `instrumentAngularRouting` is just an alias for `routingInstrumentation`; deprecate the latter at some point
Expand Down