Skip to content

Commit 2061da3

Browse files
committed
chore: switch from using static extension methods
1 parent 8bd0a8a commit 2061da3

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

modules/Sentry/public/Out-Sentry.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function Out-Sentry
101101

102102
return [Sentry.SentrySdk]::CaptureEvent($event_, [System.Action[Sentry.Scope]] {
103103
param([Sentry.Scope]$scope)
104-
[Sentry.ScopeExtensions]::AddEventProcessor($scope, $processor)
104+
$scope.AddEventProcessor($processor)
105105

106106
# Execute the script block in the caller's scope (nothing to do $scope) & set the automatic $_ variable to the $scope object.
107107
$scope | ForEach-Object $EditScope

modules/Sentry/public/Start-Sentry.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ function Start-Sentry
2121
$options.ShutDownTimeout = $options.FlushTimeout
2222
$options.ReportAssembliesMode = [Sentry.ReportAssembliesMode]::None
2323
$options.IsGlobalModeEnabled = $true
24-
[Sentry.sentryOptionsExtensions]::AddIntegration($options, [ScopeIntegration]::new())
25-
[Sentry.sentryOptionsExtensions]::AddEventProcessor($options, [EventUpdater]::new())
24+
$options.AddIntegration([ScopeIntegration]::new())
25+
$options.AddEventProcessor([EventUpdater]::new())
2626

2727
if ($DebugPreference -eq 'SilentlyContinue')
2828
{
@@ -61,7 +61,7 @@ function Start-Sentry
6161
}
6262

6363
# Workaround for https://github.com/getsentry/sentry-dotnet/issues/3141
64-
[Sentry.SentryOptionsExtensions]::DisableAppDomainProcessExitFlush($options)
64+
$options.DisableAppDomainProcessExitFlush()
6565
}
6666
process
6767
{

tests/init.tests.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Describe 'SentrySdk' {
4141
$testIntegration = [TestIntegration]::new()
4242
Start-Sentry {
4343
$_.Dsn = 'https://[email protected]/1'
44-
[Sentry.sentryOptionsExtensions]::AddIntegration($_, $testIntegration)
44+
$_.AddIntegration($testIntegration)
4545
}
4646
[Sentry.SentrySdk]::IsEnabled | Should -Be $true
4747
$testIntegration.Options | Should -BeOfType [Sentry.SentryOptions]

tests/scope.tests.ps1

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ Describe 'Edit-SentryScope' {
1515
}
1616

1717
It 'adds a file attachment via global scope' {
18-
Edit-SentryScope {
19-
[Sentry.ScopeExtensions]::AddAttachment($_, $PSCommandPath)
20-
}
18+
Edit-SentryScope { $_.AddAttachment($PSCommandPath) }
2119
'message' | Out-Sentry
2220
$transport.Envelopes.Count | Should -Be 1
2321
[Sentry.Protocol.Envelopes.Envelope]$envelope = $transport.Envelopes.ToArray()[0]
@@ -29,7 +27,7 @@ Describe 'Edit-SentryScope' {
2927
It 'adds a byte attachment via local scope' {
3028
'message' | Out-Sentry -EditScope {
3129
[byte[]] $data = 1, 2, 3, 4, 5
32-
[Sentry.ScopeExtensions]::AddAttachment($_, $data, 'filename.bin')
30+
$_.AddAttachment($data, 'filename.bin')
3331
}
3432
$transport.Envelopes.Count | Should -Be 1
3533
[Sentry.Protocol.Envelopes.Envelope]$envelope = $transport.Envelopes.ToArray()[0]

0 commit comments

Comments
 (0)