File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
packages/tracing/src/browser Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { getCurrentHub } from '@sentry/hub';
2
2
import { addInstrumentationHandler , isInstanceOf , isMatchingPattern } from '@sentry/utils' ;
3
3
4
4
import { Span } from '../span' ;
5
+ import { SpanStatus } from '../spanstatus' ;
5
6
import { getActiveTransaction , hasTracingEnabled } from '../utils' ;
6
7
7
8
export const DEFAULT_TRACING_ORIGINS = [ 'localhost' , / ^ \/ / ] ;
@@ -53,6 +54,7 @@ export interface FetchData {
53
54
// TODO Should this be unknown instead? If we vendor types, make it a Response
54
55
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55
56
response ?: any ;
57
+ error ?: unknown ;
56
58
57
59
startTimestamp : number ;
58
60
endTimestamp ?: number ;
@@ -156,11 +158,12 @@ export function fetchCallback(
156
158
if ( handlerData . endTimestamp && handlerData . fetchData . __span ) {
157
159
const span = spans [ handlerData . fetchData . __span ] ;
158
160
if ( span ) {
159
- const response = handlerData . response ;
160
- if ( response ) {
161
+ if ( handlerData . response ) {
161
162
// TODO (kmclb) remove this once types PR goes through
162
163
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
163
- span . setHttpStatus ( response . status ) ;
164
+ span . setHttpStatus ( handlerData . response . status ) ;
165
+ } else if ( handlerData . error ) {
166
+ span . setStatus ( SpanStatus . InternalError ) ;
164
167
}
165
168
span . finish ( ) ;
166
169
You can’t perform that action at this time.
0 commit comments