Private/Exceptions.psm1
|
#!/usr/bin/env pwsh using namespace System class TwilioException : System.Exception { TwilioException() : base() {} TwilioException([string]$message) : base($message) {} TwilioException([string]$message, [System.Exception]$exception) : base($message, $exception) {} } class ApiConnectionException : TwilioException { ApiConnectionException([string]$message) : base($message) {} ApiConnectionException([string]$message, [System.Exception]$exception) : base($message, $exception) {} } class AuthenticationException : TwilioException { AuthenticationException([string]$message) : base($message) {} } class ApiException : TwilioException { [int] $Code [int] $Status [string] $MoreInfo [System.Collections.IDictionary] $Details ApiException([string]$message) : base($message) {} ApiException([string]$message, [System.Exception]$exception) : base($message, $exception) {} ApiException([int]$code, [int]$status, [string]$message, [string]$moreInfo, [System.Collections.IDictionary]$details, [System.Exception]$exception) : base($message, $exception) { $this.Code = $code $this.Status = $status $this.MoreInfo = $moreInfo $this.Details = $details } } class RestException : TwilioException { [int] $Code [int] $Status [string] $MoreInfo [System.Collections.IDictionary] $Details RestException() : base() {} RestException([int]$status, [string]$message, [int]$code, [string]$moreInfo, [System.Collections.IDictionary]$details) : base($message) { $this.Status = $status $this.Code = $code $this.MoreInfo = $moreInfo $this.Details = $details } } class CertificateValidationException : TwilioException { [object] $Request [object] $Response CertificateValidationException([string]$message, [object]$request, [object]$response) : base($message) { $this.Request = $request $this.Response = $response } CertificateValidationException([string]$message, [System.Exception]$exception, [object]$request) : base($message, $exception) { $this.Request = $request } } class ApiStandardException : ApiException { [string] $Type [string] $Detail ApiStandardException([string]$message) : base($message) {} ApiStandardException([int]$code, [int]$status, [string]$message, [string]$moreInfo, [System.Collections.IDictionary]$details, [System.Exception]$exception, [string]$type, [string]$detail) : base($code, $status, $message, $moreInfo, $details, $exception) { $this.Type = $type $this.Detail = $detail } } |