Interface HttpError
- All Known Implementing Classes:
HttpError.ClientError, HttpError.NetworkFailure, HttpError.ServerError, HttpError.Timeout
@NullMarked
public sealed interface HttpError
permits HttpError.ClientError, HttpError.ServerError, HttpError.Timeout, HttpError.NetworkFailure
Typed failure hierarchy for
DmxHttpClient.
Use exhaustive switch (or instanceof checks) to handle all
failure categories without a fallthrough:
switch (error) {
case HttpError.ClientError e -> log.warn("4xx {}", e.statusCode());
case HttpError.ServerError e -> log.error("5xx {}", e.statusCode());
case HttpError.Timeout e -> log.warn("timed out", e.cause());
case HttpError.NetworkFailure e -> log.error("transport failure", e.cause());
}
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record4xx — bad request, unauthorized, not found, etc.static final recordAny failure that prevented a valid response from being produced.static final record5xx — internal server error, bad gateway, service unavailable, etc.static final recordHttpTimeoutExceptionthrown by the underlyingHttpClient.