Class AnthropicServiceException
-
- All Implemented Interfaces:
-
java.io.Serializable
public abstract class AnthropicServiceException extends AnthropicException
-
-
Field Summary
Fields Modifier and Type Field Description private final Stringmessageprivate final Throwablecauseprivate final StringlocalizedMessageprivate final Array<Throwable>suppressedprivate Array<StackTraceElement>stackTrace
-
Method Summary
Modifier and Type Method Description abstract IntegerstatusCode()abstract Headersheaders()final Optional<String>requestId()Returns the value of the request-idheader, or an empty Optional if there's no such header in the response.final Optional<String>workspaceId()Returns the value of the anthropic-workspace-idheader, or an empty Optional if there's no such header in the response.abstract JsonValuebody()final Optional<String>apiMessage()A human-readable explanation of the error. final Optional<ErrorType>type()The broad category of the error. final Optional<String>errorCode()A stable code that names the cause. final Optional<ErrorDetails>errorDetails()Machine-readable detail about the cause of the error. final Optional<ErrorType>errorType()The error type from the API response body (e.g. -
Methods inherited from class kotlin.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
statusCode
abstract Integer statusCode()
-
requestId
final Optional<String> requestId()
Returns the value of the
request-idheader, or an empty Optional if there's no such header in the response.
-
workspaceId
final Optional<String> workspaceId()
Returns the value of the
anthropic-workspace-idheader, or an empty Optional if there's no such header in the response.
-
apiMessage
final Optional<String> apiMessage()
A human-readable explanation of the error. Its wording can change, so don't match on it.
error.messageof body, or empty if it can't be read as this type.
-
type
final Optional<ErrorType> type()
The broad category of the error.
error.typeof body, or empty if it can't be read as this type.
-
errorCode
final Optional<String> errorCode()
A stable code that names the cause.
error.details.error_codeof body, or empty if it can't be read as this type.
-
errorDetails
final Optional<ErrorDetails> errorDetails()
Machine-readable detail about the cause of the error.
error_codenames the cause; branch on it rather than onmessage. Absent when the error has no code. Treat an unrecognizederror_codeas the baretype.error.detailsof body, or empty if it can't be read as this type.
-
errorType
@Deprecated(message = "Use type() instead.", replaceWith = @ReplaceWith(expression = "type()")) final Optional<ErrorType> errorType()
The error type from the API response body (e.g., ErrorType.RATE_LIMIT_ERROR, ErrorType.OVERLOADED_ERROR).
Extracted from
body.error.type. Returns Optional.empty if the body doesn't contain a structured error with a type field.
-
-
-
-