using System.Net; namespace Csob.Client; /// /// 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. /// public sealed class CsobApiException : Exception { public HttpStatusCode StatusCode { get; } /// Machine-readable error codes parsed from the ČSOB errors[].error array (best effort). public IReadOnlyList ErrorCodes { get; } /// Raw response body (already credential-free — it is the upstream's own error payload). public string? RawBody { get; } public CsobApiException(HttpStatusCode statusCode, IReadOnlyList errorCodes, string? rawBody) : base($"ČSOB PSD2 API returned {(int)statusCode} ({statusCode}).") { StatusCode = statusCode; ErrorCodes = errorCodes; RawBody = rawBody; } }