Class ErrorResponse

java.lang.Object
net.thauvin.erik.frankfurter.models.ErrorResponse
All Implemented Interfaces:
CurrenciesResult, CurrencyResult, ProvidersResult, RateResult, RatesResult

public final class ErrorResponse extends Object implements CurrenciesResult, CurrencyResult, ProvidersResult, RatesResult, RateResult
Represents an error response returned by the Frankfurter API.

This type models the structure of error payloads returned by any endpoint. It is used when the API responds with a non‑200 HTTP status code. Instances may originate from parsed JSON or from fallback text when parsing fails.

ErrorResponse participates in all result hierarchies (CurrenciesResult, CurrencyResult, ProvidersResult, RatesResult, RateResult) so callers can uniformly handle success and error outcomes.

Since:
1.0
Author:
Erik C. Thauvin
  • Constructor Details

    • ErrorResponse

      public ErrorResponse(int status, @Nullable String message)
      Creates a new error response.
      Parameters:
      status - the HTTP status code returned by the API
      message - the error message, or null if none was provided
  • Method Details

    • message

      public @Nullable String message()
      Returns the error message provided by the API.
      Returns:
      the error message, or null if none was provided
    • status

      public int status()
      Returns the HTTP status code associated with this error.
      Returns:
      the HTTP status code