private static string CreateFullMessageString(string message, AcmeError error) { string firstLine = string.IsNullOrWhiteSpace(message) ? defaultMessageString : message; if (string.IsNullOrWhiteSpace(error.Detail)) { return(firstLine); } return($"{firstLine}{Environment.NewLine}Detail: {error.Detail}"); }
/// <summary> /// Creates a new ACME exception with a custom message from the specified ACME error instance and a reference to the specified inner exceoption that is the cause of this exception. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="error">The ACME error that is transmitted as the payload body to an ACME client instead of a successful response message.</param> /// <param name="innerException">The exception that is the cause of the current exception, or a <c>null</c> reference if no inner exception is specified.</param> public AcmeException(string message, AcmeError error, Exception innerException) : base(CreateFullMessageString(message, error), innerException) { Error = error; }
/// <summary> /// Creates a new ACME exception with a custom message from the specified ACME error instance. /// </summary> /// <param name="message">The message that describes the error.</param> /// <param name="error">The ACME error that is transmitted as the payload body to an ACME client instead of a successful response message.</param> public AcmeException(string message, AcmeError error) : base(CreateFullMessageString(message, error)) { Error = error; }
/// <summary> /// Creates a new ACME exception from the specified ACME error instance and a reference to an inner exception that is the cause of this exception. /// </summary> /// <param name="error">The ACME error that is transmitted as the payload body to an ACME client instead of a successful response message.</param> /// <param name="innerException">The exception that is the cause of the current exception, or a <c>null</c> reference if no inner exception is specified.</param> /// <remarks><paramref name="innerException"/> will typically be a reference to the exception that is thrown when the client validates the status code of the received response message.</remarks> public AcmeException(AcmeError error, Exception innerException) : this(defaultMessageString, error, innerException) { }
/// <summary> /// Creates a new ACME exception from the specified ACME error instance. /// </summary> /// <param name="error">The ACME error that is transmitted as the payload body to an ACME client instead of a successful response message.</param> public AcmeException(AcmeError error) : this(defaultMessageString, error) { }