Class SchemaRegistryException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.krabka.streams.schema.SchemaRegistryException
- All Implemented Interfaces:
Serializable
Reports a schema registry transport, status, or response error.
Thrown by KrabkaSchemaRegistryClient when a request cannot be sent, the
registry answers with a non-2xx status, or the response body cannot be parsed.
Because the client is asynchronous, the exception usually arrives as the cause of a
CompletionException.
Example
client.latest("orders-value").exceptionally(error -> {
if (error.getCause() instanceof SchemaRegistryException registry
&& registry.statusCode() == 404) {
return null; // subject does not exist yet
}
throw new CompletionException(error);
});
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaRegistryException(int statusCode, String body) Creates an exception for a non-2xx registry response.SchemaRegistryException(String message) Creates an exception for a malformed request or response.SchemaRegistryException(String message, Throwable cause) Creates an exception for a transport or encoding failure. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the HTTP status, or-1for a transport or parsing error.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
SchemaRegistryException
Creates an exception for a malformed request or response.- Parameters:
message- a description of the failure
-
SchemaRegistryException
-
SchemaRegistryException
Creates an exception for a non-2xx registry response.- Parameters:
statusCode- the HTTP status returned by the registrybody- the response body, included in the message
-
-
Method Details
-
statusCode
public int statusCode()Returns the HTTP status, or-1for a transport or parsing error.- Returns:
- the HTTP status code, or
-1when no status was received
-