KubernetesException: Add an constructor overload which takes a V1Status and an inner exception. (#553)

This commit is contained in:
Frederik Carlier
2021-01-26 19:51:39 -08:00
committed by GitHub
parent aeb3a0bcc6
commit 46d4eaa7d8
2 changed files with 20 additions and 3 deletions

View File

@@ -47,7 +47,7 @@ namespace k8s
}
catch (HttpOperationException httpEx) when (httpEx.Body is V1Status)
{
throw new KubernetesException((V1Status)httpEx.Body);
throw new KubernetesException((V1Status)httpEx.Body, httpEx);
}
}

View File

@@ -17,8 +17,7 @@ namespace k8s
}
/// <summary>
/// Initializes a new instance of the <see cref="KubernetesException"/> class.
/// Initializes a ne winstance of the <see cref="KubernetesException"/> class using
/// Initializes a new instance of the <see cref="KubernetesException"/> class using
/// the data from a <see cref="V1Status"/> object.
/// </summary>
/// <param name="status">
@@ -30,6 +29,24 @@ namespace k8s
Status = status;
}
/// <summary>
/// Initializes a new instance of the <see cref="KubernetesException"/> class using
/// the data from a <see cref="V1Status"/> object and a reference to the inner exception
/// that is the cause of this exception..
/// </summary>
/// <param name="status">
/// A status message which triggered this exception to be thrown.
/// </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(V1Status status, Exception innerException)
: this(status?.Message, innerException)
{
Status = status;
}
/// <summary>
/// Initializes a new instance of the <see cref="KubernetesException"/> class with an error message.
/// </summary>