remove Write-Warning for CAPIErrors.

Allow them to bubble up.
(Might be worth adding a helper function to print stacktrace?)
This commit is contained in:
2023-08-16 16:36:43 +01:00
parent 844eaeabaa
commit 9b3d9f2250
4 changed files with 74 additions and 167 deletions

View File

@@ -137,30 +137,20 @@ Function Get-RemotePotato {
Function Connect-Voicemeeter {
param([String]$Kind)
try {
switch ($Kind) {
"basic" {
return Get-RemoteBasic
}
"banana" {
return Get-RemoteBanana
}
"potato" {
return Get-RemotePotato
}
default { throw [LoginError]::new("Unknown Voicemeeter kind `"$Kind`"") }
}
}
catch [LoginError], [CAPIError] {
Write-Warning $_.Exception.ErrorMessage()
throw
}
catch [VMRemoteError] {
$_.Exception.ErrorMessage() | Write-Warning
if ($_.Exception.ErrorMessage() -eq "Couldn't get Voicemeeter path") {
Exit -1
switch ($Kind) {
"basic" {
return Get-RemoteBasic
}
}
"banana" {
return Get-RemoteBanana
}
"potato" {
return Get-RemotePotato
}
default {
throw [LoginError]::new("Unknown Voicemeeter kind `"$Kind`"")
}
}
}
Function Disconnect-Voicemeeter {