27 lines
974 B
C#
27 lines
974 B
C#
using System.Net;
|
|
|
|
namespace Csob.Client;
|
|
|
|
/// <summary>
|
|
/// Raised when the ČSOB PSD2 API returns a non-success HTTP status. Carries the upstream status
|
|
/// and the raw error body so the middleware can surface it without leaking credentials.
|
|
/// </summary>
|
|
public sealed class CsobApiException : Exception
|
|
{
|
|
public HttpStatusCode StatusCode { get; }
|
|
|
|
/// <summary>Machine-readable error codes parsed from the ČSOB <c>errors[].error</c> array (best effort).</summary>
|
|
public IReadOnlyList<string> ErrorCodes { get; }
|
|
|
|
/// <summary>Raw response body (already credential-free — it is the upstream's own error payload).</summary>
|
|
public string? RawBody { get; }
|
|
|
|
public CsobApiException(HttpStatusCode statusCode, IReadOnlyList<string> errorCodes, string? rawBody)
|
|
: base($"ČSOB PSD2 API returned {(int)statusCode} ({statusCode}).")
|
|
{
|
|
StatusCode = statusCode;
|
|
ErrorCodes = errorCodes;
|
|
RawBody = rawBody;
|
|
}
|
|
}
|