io.enterpriseai.errors.EaiException
Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/errors/EaiException.java. Back to the Java SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class EaiException
Base exception built from the Control Plane error envelope {@code {"error": {"code", "message", "message_i18n", "details", "request_id"}}}. The message is localized (en/fr) and the machine #code() never changes.
RuntimeException
Constructor EaiException
EaiException(int status, String code, String message, JsonNode details, String requestId, Long retryAfterSeconds)
Creates the exception from the fields of the error envelope, or from a code, a message and a cause for a network error (status 0).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
status | int | yes | HTTP status of the response, 0 for a network error. | |
code | String | yes | Stable machine code of the error, such as policy_denied. | |
message | String | yes | Message already localized in the client language. | |
details | JsonNode | yes | error.details of the envelope, redacted; null becomes a MissingNode. | |
requestId | String | yes | error.request_id or the X-Request-Id header, may be null. | |
retryAfterSeconds | Long | yes | Retry-After delay in seconds, or null. |
Constructor EaiException
EaiException(String code, String message, Throwable cause)
Creates the exception from the fields of the error envelope, or from a code, a message and a cause for a network error (status 0).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
code | String | yes | Stable machine code of the error, such as policy_denied. | |
message | String | yes | Message already localized in the client language. | |
cause | Throwable | yes | Underlying exception, such as an IOException. |
EaiException.code
String code()
Stable machine code such as policy_denied.
This element takes no parameter.
Returns: String. The machine code of the error, such as policy_denied.
EaiException.details
JsonNode details()
error.details, a MissingNode when absent.
This element takes no parameter.
Returns: JsonNode. The error details with secrets redacted, never null (MissingNode when absent).
EaiException.requestId
String requestId()
error.request_id or the X-Request-Id response header.
This element takes no parameter.
Returns: String. The request id to quote to support, or null.
EaiException.retryAfterSeconds
Long retryAfterSeconds()
Retry-After in seconds when the server sent one.
This element takes no parameter.
Returns: Long. The delay to wait in seconds, or null without a Retry-After header.
EaiException.status
int status()
HTTP status, 0 for network errors.
This element takes no parameter.
Returns: int. The HTTP status, or 0 for a network error.