@sentry/react
Advanced tools
Comparing version
@@ -8,2 +8,3 @@ import * as Sentry from '@sentry/browser'; | ||
resetError(): void; | ||
eventId: string | null; | ||
}) => React.ReactNode; | ||
@@ -28,9 +29,9 @@ export declare type ErrorBoundaryProps = { | ||
/** Called with the error boundary encounters an error */ | ||
onError?(error: Error, componentStack: string): void; | ||
onError?(error: Error, componentStack: string, eventId: string): void; | ||
/** Called on componentDidMount() */ | ||
onMount?(): void; | ||
/** Called if resetError() is called from the fallback render props function */ | ||
onReset?(error: Error | null, componentStack: string | null): void; | ||
onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void; | ||
/** Called on componentWillUnmount() */ | ||
onUnmount?(error: Error | null, componentStack: string | null): void; | ||
onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void; | ||
}; | ||
@@ -40,2 +41,3 @@ declare type ErrorBoundaryState = { | ||
error: Error | null; | ||
eventId: string | null; | ||
}; | ||
@@ -42,0 +44,0 @@ /** |
@@ -11,2 +11,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
error: null, | ||
eventId: null, | ||
}; | ||
@@ -24,4 +25,5 @@ /** | ||
var onReset = _this.props.onReset; | ||
var _a = _this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
if (onReset) { | ||
onReset(_this.state.error, _this.state.componentStack); | ||
onReset(error, componentStack, eventId); | ||
} | ||
@@ -37,3 +39,3 @@ _this.setState(INITIAL_STATE); | ||
if (onError) { | ||
onError(error, componentStack); | ||
onError(error, componentStack, eventId); | ||
} | ||
@@ -45,3 +47,3 @@ if (showDialog) { | ||
// so that componentStack is accessible through state. | ||
this.setState({ error: error, componentStack: componentStack }); | ||
this.setState({ error: error, componentStack: componentStack, eventId: eventId }); | ||
}; | ||
@@ -55,6 +57,6 @@ ErrorBoundary.prototype.componentDidMount = function () { | ||
ErrorBoundary.prototype.componentWillUnmount = function () { | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
var onUnmount = this.props.onUnmount; | ||
if (onUnmount) { | ||
onUnmount(error, componentStack); | ||
onUnmount(error, componentStack, eventId); | ||
} | ||
@@ -64,3 +66,3 @@ }; | ||
var fallback = this.props.fallback; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
if (error) { | ||
@@ -71,3 +73,3 @@ if (React.isValidElement(fallback)) { | ||
if (typeof fallback === 'function') { | ||
return fallback({ error: error, componentStack: componentStack, resetError: this.resetErrorBoundary }); | ||
return fallback({ error: error, componentStack: componentStack, resetError: this.resetErrorBoundary, eventId: eventId }); | ||
} | ||
@@ -74,0 +76,0 @@ // Fail gracefully if no fallback provided |
@@ -8,2 +8,3 @@ import * as Sentry from '@sentry/browser'; | ||
resetError(): void; | ||
eventId: string | null; | ||
}) => React.ReactNode; | ||
@@ -28,9 +29,9 @@ export declare type ErrorBoundaryProps = { | ||
/** Called with the error boundary encounters an error */ | ||
onError?(error: Error, componentStack: string): void; | ||
onError?(error: Error, componentStack: string, eventId: string): void; | ||
/** Called on componentDidMount() */ | ||
onMount?(): void; | ||
/** Called if resetError() is called from the fallback render props function */ | ||
onReset?(error: Error | null, componentStack: string | null): void; | ||
onReset?(error: Error | null, componentStack: string | null, eventId: string | null): void; | ||
/** Called on componentWillUnmount() */ | ||
onUnmount?(error: Error | null, componentStack: string | null): void; | ||
onUnmount?(error: Error | null, componentStack: string | null, eventId: string | null): void; | ||
}; | ||
@@ -40,2 +41,3 @@ declare type ErrorBoundaryState = { | ||
error: Error | null; | ||
eventId: string | null; | ||
}; | ||
@@ -42,0 +44,0 @@ /** |
@@ -9,2 +9,3 @@ import { __assign, __extends } from "tslib"; | ||
error: null, | ||
eventId: null, | ||
}; | ||
@@ -22,4 +23,5 @@ /** | ||
var onReset = _this.props.onReset; | ||
var _a = _this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
if (onReset) { | ||
onReset(_this.state.error, _this.state.componentStack); | ||
onReset(error, componentStack, eventId); | ||
} | ||
@@ -35,3 +37,3 @@ _this.setState(INITIAL_STATE); | ||
if (onError) { | ||
onError(error, componentStack); | ||
onError(error, componentStack, eventId); | ||
} | ||
@@ -43,3 +45,3 @@ if (showDialog) { | ||
// so that componentStack is accessible through state. | ||
this.setState({ error: error, componentStack: componentStack }); | ||
this.setState({ error: error, componentStack: componentStack, eventId: eventId }); | ||
}; | ||
@@ -53,6 +55,6 @@ ErrorBoundary.prototype.componentDidMount = function () { | ||
ErrorBoundary.prototype.componentWillUnmount = function () { | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
var onUnmount = this.props.onUnmount; | ||
if (onUnmount) { | ||
onUnmount(error, componentStack); | ||
onUnmount(error, componentStack, eventId); | ||
} | ||
@@ -62,3 +64,3 @@ }; | ||
var fallback = this.props.fallback; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack; | ||
var _a = this.state, error = _a.error, componentStack = _a.componentStack, eventId = _a.eventId; | ||
if (error) { | ||
@@ -69,3 +71,3 @@ if (React.isValidElement(fallback)) { | ||
if (typeof fallback === 'function') { | ||
return fallback({ error: error, componentStack: componentStack, resetError: this.resetErrorBoundary }); | ||
return fallback({ error: error, componentStack: componentStack, resetError: this.resetErrorBoundary, eventId: eventId }); | ||
} | ||
@@ -72,0 +74,0 @@ // Fail gracefully if no fallback provided |
{ | ||
"name": "@sentry/react", | ||
"version": "5.18.1", | ||
"version": "5.19.0", | ||
"description": "Offical Sentry SDK for React.js", | ||
@@ -19,5 +19,5 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry/browser": "5.18.1", | ||
"@sentry/types": "5.18.1", | ||
"@sentry/utils": "5.18.1", | ||
"@sentry/browser": "5.19.0", | ||
"@sentry/types": "5.19.0", | ||
"@sentry/utils": "5.19.0", | ||
"hoist-non-react-statics": "^3.3.2", | ||
@@ -24,0 +24,0 @@ "tslib": "^1.9.3" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92733
1.93%839
0.96%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated