mirror of
https://github.com/onyx-and-iris/voicemeeter-api-powershell.git
synced 2026-04-18 13:33:31 +00:00
added custom error classes
Added CAPI and Login custom error classes. Cleaned up output when error is thrown.
This commit is contained in:
25
lib/errors.ps1
Normal file
25
lib/errors.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
class LoginError : Exception {
|
||||
[String]$msg
|
||||
|
||||
LoginError([String]$msg) {
|
||||
$this.msg = $msg
|
||||
}
|
||||
|
||||
[String] ErrorMessage() {
|
||||
return $this.msg
|
||||
}
|
||||
}
|
||||
|
||||
class CAPIError : Exception {
|
||||
[Int]$retval
|
||||
[String]$caller
|
||||
|
||||
CAPIError([Int]$retval, [String]$caller) {
|
||||
$this.retval = $retval
|
||||
$this.caller = $caller
|
||||
}
|
||||
|
||||
[String] ErrorMessage() {
|
||||
return "ERROR: CAPI return value: {0} in {1}" -f $this.retval, $this.caller
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user