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';
22import { addInstrumentationHandler , isInstanceOf , isMatchingPattern } from '@sentry/utils' ;
33
44import { Span } from '../span' ;
5+ import { SpanStatus } from '../spanstatus' ;
56import { getActiveTransaction , hasTracingEnabled } from '../utils' ;
67
78export const DEFAULT_TRACING_ORIGINS = [ 'localhost' , / ^ \/ / ] ;
@@ -53,6 +54,7 @@ export interface FetchData {
5354 // TODO Should this be unknown instead? If we vendor types, make it a Response
5455 // eslint-disable-next-line @typescript-eslint/no-explicit-any
5556 response ?: any ;
57+ error ?: unknown ;
5658
5759 startTimestamp : number ;
5860 endTimestamp ?: number ;
@@ -156,11 +158,12 @@ export function fetchCallback(
156158 if ( handlerData . endTimestamp && handlerData . fetchData . __span ) {
157159 const span = spans [ handlerData . fetchData . __span ] ;
158160 if ( span ) {
159- const response = handlerData . response ;
160- if ( response ) {
161+ if ( handlerData . response ) {
161162 // TODO (kmclb) remove this once types PR goes through
162163 // 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 ) ;
164167 }
165168 span . finish ( ) ;
166169
You can’t perform that action at this time.
0 commit comments