Package com.sap.ai.sdk.core.common
Interface ClientExceptionFactory<E extends ClientException,R extends ClientError>
- Type Parameters:
E- The subtype ofClientExceptionto be created by this factory.R- The subtype ofClientErrorpayload that can be processed by this factory.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface ClientExceptionFactory<E extends ClientException,R extends ClientError>
A factory whose implementations can provide customized exception types and error mapping logic
for different service clients or error scenarios.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ECreates an exception with a message and optional cause.default ECreates an exception with a message and optional cause.Creates an exception from a given message and an HTTP error response that has been successfully deserialized into aClientErrorobject.
-
Method Details
-
build
Creates an exception with a message and optional cause.- Parameters:
message- A descriptive message for the exception.cause- An optional cause of the exception, can be null if not applicable.- Returns:
- An instance of the specified
ClientExceptiontype
-
build
Creates an exception with a message and optional cause.- Parameters:
message- A descriptive message for the exception.- Returns:
- An instance of the specified
ClientExceptiontype
-
build
Creates an exception from a given message and an HTTP error response that has been successfully deserialized into aClientErrorobject.- Parameters:
message- A descriptive message for the exception.clientError- The structuredClientErrorobject deserialized from the response, null if not exist.cause- An optional cause of the exception, can be null if not applicable.- Returns:
- An instance of the specified
ClientExceptiontype
-