using System;
namespace Unity.Services.Authentication
{
///
/// AuthenticationException represents a runtime exception from authentication.
///
public class AuthenticationException : Exception
{
///
/// The error code is the identifier for the type of error to handle.
/// Checkout AuthenticationError for error codes.
///
public string ErrorCode { get; private set; }
///
/// Constructor of the AuthenticationException with error code.
///
/// The error code for AuthenticationException.
public AuthenticationException(string errorCode)
: base(errorCode)
{
ErrorCode = errorCode;
}
///
/// Constructor of the AuthenticationException with error code and a message.
///
/// The error code for AuthenticationException.
/// The additional message that helps to debug.
public AuthenticationException(string errorCode, string message)
: base(errorCode + ": " + message)
{
ErrorCode = errorCode;
}
///
/// Constructor of the AuthenticationException with error code, a message and inner exception.
///
/// The error code for AuthenticationException.
/// The additional message that helps to debug.
/// The cause of the exception.
public AuthenticationException(string errorCode, string message, Exception innerException)
: base(errorCode + ": " + message, innerException)
{
ErrorCode = errorCode;
}
}
}