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
2323 const eventData = isRemixErrorResponse
2424 ? {
2525 function : 'ErrorResponse' ,
26- ...error . data ,
26+ ...getErrorData ( error ) ,
2727 }
2828 : {
2929 function : 'ReactError' ,
3030 } ;
3131
3232 const actualError = isRemixErrorResponse ? getExceptionToCapture ( error ) : error ;
33+
3334 eventId = captureException ( actualError , {
3435 mechanism : {
3536 type : 'instrument' ,
@@ -42,10 +43,21 @@ export function captureRemixErrorBoundaryError(error: unknown): string | undefin
4243 return eventId ;
4344}
4445
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+
4556function getExceptionToCapture ( error : ErrorResponse ) : string | ErrorResponse {
4657 if ( isString ( error . data ) ) {
4758 return error . data ;
4859 }
60+
4961 if ( error . statusText ) {
5062 return error . statusText ;
5163 }
You can’t perform that action at this time.
0 commit comments