Skip to content

Commit e989407

Browse files
committed
Added error (and component stack) to tooltip title
1 parent 2c99f6e commit e989407

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-error-boundary",
3-
"version": "0.0.4",
3+
"version": "0.0.5",
44
"description": "Simple reusable React error boundary component",
55
"files": [
66
"dist"

src/ErrorBoundaryFallbackComponent.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ type Props = {
77
error: Error,
88
};
99

10+
const toTitle = (error: Error, componentStack: string): string => {
11+
return `${error}\n\nThis is located at:${componentStack}`;
12+
};
13+
1014
const ErrorBoundaryFallbackComponent = ({ componentStack, error }: Props) => (
11-
<div style={style} title={error.toString()}>
15+
<div style={style} title={toTitle(error, componentStack)}>
1216
<svg style={svgStyle} viewBox="0 0 24 24" preserveAspectRatio="xMidYMid">
1317
<path d={`M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
1418
12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
@@ -33,6 +37,7 @@ const style = {
3337
backgroundColor: '#C00',
3438
color: '#FFF',
3539
boxSizing: 'border-box',
40+
cursor: 'help',
3641
};
3742

3843
const svgStyle = {

0 commit comments

Comments
 (0)