diff --git a/lib/base.ps1 b/lib/base.ps1 index 5ec59ff..bcc5769 100644 --- a/lib/base.ps1 +++ b/lib/base.ps1 @@ -41,10 +41,11 @@ function Login { elseif ($retval -eq -2) { throw [LoginError]::new('Login may only be called once per session') } - else { exit } + else { throw [CAPIError]::new($retval, $MyInvocation.MyCommand) } } catch [LoginError], [CAPIError] { Write-Warning $_.Exception.ErrorMessage() + exit } while (P_Dirty -or M_Dirty) { Start-Sleep -m 1 } diff --git a/lib/binding.ps1 b/lib/binding.ps1 index f3a3c86..99550c7 100644 --- a/lib/binding.ps1 +++ b/lib/binding.ps1 @@ -5,11 +5,9 @@ function Setup_DLL { if ([string]::IsNullOrWhiteSpace($vb_path)) { throw [VMRemoteErrors]::new("ERROR: Couldn't get Voicemeeter path") } - else { - $dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + ` - (& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + ` - ".dll") - } + $dll = Join-Path -Path $vb_path -ChildPath ("VoicemeeterRemote" + ` + (& { if ([Environment]::Is64BitOperatingSystem) { "64" } else { "" } }) + ` + ".dll") } catch [VMRemoteErrors] { Write-Warning $_.Exception.ErrorMessage()