2018-04-28 05:51:02 +02:00
|
|
|
using k8s.Models;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace k8s
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Represents an error message returned by the Kubernetes API server.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class KubernetesException : Exception
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public KubernetesException()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2020-11-22 14:52:09 -08:00
|
|
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class.
|
2018-04-28 05:51:02 +02:00
|
|
|
/// Initializes a ne winstance of the <see cref="KubernetesException"/> class using
|
|
|
|
|
/// the data from a <see cref="V1Status"/> object.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="status">
|
|
|
|
|
/// A status message which triggered this exception to be thrown.
|
|
|
|
|
/// </param>
|
|
|
|
|
public KubernetesException(V1Status status)
|
|
|
|
|
: this(status?.Message)
|
|
|
|
|
{
|
2020-11-22 14:52:09 -08:00
|
|
|
Status = status;
|
2018-04-28 05:51:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class with an error message.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message">
|
|
|
|
|
/// The error message that explains the reason for the exception.
|
|
|
|
|
/// </param>
|
|
|
|
|
public KubernetesException(string message)
|
|
|
|
|
: base(message)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class with a specified error
|
|
|
|
|
/// message and a reference to the inner exception that is the cause of this exception.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="message">
|
|
|
|
|
/// The error message that explains the reason for the exception.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="innerException">
|
|
|
|
|
/// The exception that is the cause of the current exception, or <see langword="null"/>
|
|
|
|
|
/// if no inner exception is specified.
|
|
|
|
|
/// </param>
|
|
|
|
|
public KubernetesException(string message, Exception innerException)
|
|
|
|
|
: base(message, innerException)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Initializes a new instance of the <see cref="KubernetesException"/> class with serialized data.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="info">
|
|
|
|
|
/// The <see cref="SerializationInfo"/> that holds the serialized
|
|
|
|
|
/// object data about the exception being thrown.
|
|
|
|
|
/// </param>
|
|
|
|
|
/// <param name="context">
|
|
|
|
|
/// The <see cref="StreamingContext"/> that contains contextual information
|
|
|
|
|
/// about the source or destination.
|
|
|
|
|
/// </param>
|
|
|
|
|
protected KubernetesException(SerializationInfo info, StreamingContext context)
|
|
|
|
|
: base(info, context)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets, when this exception was raised because of a Kubernetes status message, the underlying
|
|
|
|
|
/// Kubernetes status message.
|
|
|
|
|
/// </summary>
|
2020-04-23 11:40:06 -07:00
|
|
|
public V1Status Status { get; private set; }
|
2018-04-28 05:51:02 +02:00
|
|
|
}
|
|
|
|
|
}
|