Package com.sap.ai.sdk.core.common
Class ClientException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.sap.ai.sdk.core.common.ClientException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OpenAiClientException,OrchestrationClientException
Generic exception for errors occurring when using AI SDK clients.
- Since:
- 1.1.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionClientException(String message) ClientException(String message, Throwable cause) ClientException(Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionWraps a structured error payload received from the remote service, if available.org.apache.hc.core5.http.ClassicHttpRequestThe original HTTP request that caused this exception, if available.org.apache.hc.core5.http.ClassicHttpResponseThe original HTTP response that caused this exception, if available.<T extends ClientException>
TsetClientError(ClientError clientError) Sets the original HTTP request that caused this exception.<T extends ClientException>
TsetHttpRequest(org.apache.hc.core5.http.ClassicHttpRequest httpRequest) Sets the original HTTP request that caused this exception.<T extends ClientException>
TsetHttpResponse(org.apache.hc.core5.http.ClassicHttpResponse httpResponse) Sets the original HTTP request that caused this exception.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClientException
public ClientException() -
ClientException
-
ClientException
-
ClientException
-
-
Method Details
-
setClientError
Sets the original HTTP request that caused this exception.- Type Parameters:
T- the type of the exception, typically a subclass ofClientException- Parameters:
clientError- the original structured error payload received from the remote service, can be null if not available.- Returns:
- the current instance of
ClientExceptionwith the changed ClientError data
-
setHttpResponse
@Nonnull public <T extends ClientException> T setHttpResponse(@Nullable org.apache.hc.core5.http.ClassicHttpResponse httpResponse) Sets the original HTTP request that caused this exception.- Type Parameters:
T- the type of the exception, typically a subclass ofClientException- Parameters:
httpResponse- the original HTTP response that caused this exception, can be null if not available.- Returns:
- the current instance of
ClientExceptionwith the changed HTTP response
-
setHttpRequest
@Nonnull public <T extends ClientException> T setHttpRequest(@Nullable org.apache.hc.core5.http.ClassicHttpRequest httpRequest) Sets the original HTTP request that caused this exception.- Type Parameters:
T- the type of the exception, typically a subclass ofClientException- Parameters:
httpRequest- the original HTTP request that caused this exception, can be null if not available.- Returns:
- the current instance of
ClientExceptionwith the changed HTTP request
-
getClientError
Wraps a structured error payload received from the remote service, if available. This can be used to extract more detailed error information.- Since:
- 1.10.0
-
getHttpResponse
@Nullable public org.apache.hc.core5.http.ClassicHttpResponse getHttpResponse()The original HTTP response that caused this exception, if available.- Since:
- 1.10.0
-
getHttpRequest
@Nullable public org.apache.hc.core5.http.ClassicHttpRequest getHttpRequest()The original HTTP request that caused this exception, if available.- Since:
- 1.10.0
-