Skip to content

Commit 5cb1f37

Browse files
authored
Add missing await for finishing transaction/span Dart/Flutter (#4277)
1 parent 5fe07de commit 5cb1f37

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/includes/performance/add-spans-example/dart.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import 'package:sentry/sentry.dart';
88
final transaction = Sentry.startTransaction('processOrderBatch()', 'task');
99
1010
try {
11-
processOrderBatch(transaction);
11+
await processOrderBatch(transaction);
1212
} catch (exception) {
1313
transaction.throwable = exception;
1414
transaction.status = SpanStatus.internalError();
1515
} finally {
16-
transaction.finish();
16+
await transaction.finish();
1717
}
1818
19-
void processOrderBatch(ISentrySpan span) {
19+
Future<void> processOrderBatch(ISentrySpan span) async {
2020
// span operation: task, span description: operation
2121
final innerSpan = span.startChild('task', description: 'operation');
2222
@@ -26,7 +26,7 @@ void processOrderBatch(ISentrySpan span) {
2626
innerSpan.throwable = exception;
2727
innerSpan.status = SpanStatus.notFound();
2828
} finally {
29-
innerSpan.finish();
29+
await innerSpan.finish();
3030
}
3131
}
3232
```

src/includes/performance/connect-errors-spans/dart.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ try {
1818
} catch (exception) {
1919
Sentry.captureException(exception);
2020
} finally {
21-
transaction.finish();
21+
await transaction.finish();
2222
}
2323
```
2424

@@ -35,6 +35,6 @@ try {
3535
transaction.throwable = exception;
3636
rethrow;
3737
} finally {
38-
transaction.finish();
38+
await transaction.finish();
3939
}
4040
```

src/includes/performance/enable-manual-instrumentation/dart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ try {
1111
transaction.throwable = exception;
1212
transaction.status = SpanStatus.internalError();
1313
} finally {
14-
transaction.finish();
14+
await transaction.finish();
1515
}
1616
```

src/includes/performance/retrieve-transaction/dart.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ try {
1414
span.throwable = exception;
1515
span.status = SpanStatus.internalError();
1616
} finally {
17-
span.finish();
17+
await span.finish();
1818
}
1919
```

0 commit comments

Comments
 (0)