File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
packages/remix/src/client Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,14 @@ export function captureRemixErrorBoundaryError(error: unknown): string | undefin
23
23
const eventData = isRemixErrorResponse
24
24
? {
25
25
function : 'ErrorResponse' ,
26
- ...error . data ,
26
+ ...getErrorData ( error ) ,
27
27
}
28
28
: {
29
29
function : 'ReactError' ,
30
30
} ;
31
31
32
32
const actualError = isRemixErrorResponse ? getExceptionToCapture ( error ) : error ;
33
+
33
34
eventId = captureException ( actualError , {
34
35
mechanism : {
35
36
type : 'instrument' ,
@@ -42,10 +43,21 @@ export function captureRemixErrorBoundaryError(error: unknown): string | undefin
42
43
return eventId ;
43
44
}
44
45
46
+ function getErrorData ( error : ErrorResponse ) : object {
47
+ if ( isString ( error . data ) ) {
48
+ return {
49
+ error : error . data ,
50
+ } ;
51
+ }
52
+
53
+ return error . data ;
54
+ }
55
+
45
56
function getExceptionToCapture ( error : ErrorResponse ) : string | ErrorResponse {
46
57
if ( isString ( error . data ) ) {
47
58
return error . data ;
48
59
}
60
+
49
61
if ( error . statusText ) {
50
62
return error . statusText ;
51
63
}
You can’t perform that action at this time.
0 commit comments