@@ -20,21 +20,15 @@ function traceHeaders(this: Hub): { [key: string]: string } {
20
20
}
21
21
22
22
/**
23
- * This functions starts a span. If there is already a `Span` on the Scope,
24
- * the created Span with the SpanContext will have a reference to it and become it's child.
25
- * Otherwise it'll crete a new `Span`.
26
- *
27
- * @param context Properties with which the span should be created
23
+ * {@see Hub.startSpan }
28
24
*/
29
25
function startSpan ( this : Hub , context : SpanContext | TransactionContext ) : Transaction | Span {
30
26
/**
31
27
* @deprecated
32
28
* We have this here as a fallback to not break users upgrading to the new API
33
29
*/
34
- if ( ( context as any ) . transaction ) {
35
- logger . warn (
36
- `Please use \`Sentry.startTransaction({name: ${ ( context as any ) . transaction } })\` to start a Transaction.` ,
37
- ) ;
30
+ if ( ( context as any ) . transaction !== undefined ) {
31
+ logger . warn ( `Use \`Sentry.startTransaction({name: ${ ( context as any ) . transaction } })\` to start a Transaction.` ) ;
38
32
( context as TransactionContext ) . name = ( context as any ) . transaction as string ;
39
33
( context as TransactionContext ) . _isTransaction = true ;
40
34
}
@@ -44,8 +38,9 @@ function startSpan(this: Hub, context: SpanContext | TransactionContext): Transa
44
38
// if the user really wanted to create a Transaction.
45
39
if ( ( context as TransactionContext ) . _isTransaction && ! ( context as TransactionContext ) . name ) {
46
40
logger . warn ( 'You are trying to start a Transaction but forgot to provide a `name` property.' ) ;
47
- logger . warn ( 'Will fall back to <unlabeled transaction>, use `transaction.setName()` to change it.' ) ;
48
- ( context as TransactionContext ) . name = '<unlabeled transaction>' ;
41
+ const name = '<unlabeled transaction>' ;
42
+ logger . warn ( `Will fall back to \`${ name } \`` ) ;
43
+ ( context as TransactionContext ) . name = name ;
49
44
}
50
45
51
46
if ( ( context as TransactionContext ) . name ) {
0 commit comments