Table of Contents

Class VonageAuthenticationException

Namespace
Vonage.Common.Exceptions
Assembly
Vonage.dll

Represents an error when processing authentication.

public class VonageAuthenticationException : Exception, ISerializable
Inheritance
VonageAuthenticationException
Implements
Inherited Members

Examples

// Thrown when credentials are missing
if (string.IsNullOrEmpty(apiKey))
{
    throw VonageAuthenticationException.FromMissingApiKeyOrSecret();
}

Methods

FromError(string)

Creates an exception from a custom error message.

public static VonageAuthenticationException FromError(string failure)

Parameters

failure string

The failure message.

Returns

VonageAuthenticationException

The exception.

Examples

throw VonageAuthenticationException.FromError("Token has expired");

FromMissingApiKeyOrSecret()

Creates an exception indicating the ApiKey or ApiSecret are missing.

public static VonageAuthenticationException FromMissingApiKeyOrSecret()

Returns

VonageAuthenticationException

The exception.

Examples

throw VonageAuthenticationException.FromMissingApiKeyOrSecret();
// Message: "API Key or API Secret missing."

FromMissingApplicationIdOrPrivateKey()

Creates an exception indicating the ApplicationId or PrivateKeyPath are missing.

public static VonageAuthenticationException FromMissingApplicationIdOrPrivateKey()

Returns

VonageAuthenticationException

The exception.

Examples

throw VonageAuthenticationException.FromMissingApplicationIdOrPrivateKey();
// Message: "AppId or Private Key Path missing."