Skip to content

Commit c85b27c

Browse files
authored
fix: marking transaction as failed (#66)
1 parent bc2d65b commit c85b27c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

samples/locate-city.ps1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ try
5454
}
5555
}
5656
$span.Finish()
57-
57+
$transaction.Finish()
5858
if ($FoundOne)
5959
{
6060
exit 0 # success
@@ -64,11 +64,9 @@ try
6464
}
6565
catch
6666
{
67+
# Mark the transaction as finished (note: this needs to be done prior to calling Out-Sentry)
68+
$transaction.Finish($_.Exception)
69+
6770
$_ | Out-Sentry
6871
"⚠️ Error on line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
6972
}
70-
finally
71-
{
72-
# Mark the transaction as finished and send it to Sentry
73-
$transaction.Finish()
74-
}

0 commit comments

Comments
 (0)