Package com.anthropic.models.beta
Class BetaError
-
- All Implemented Interfaces:
public final class BetaError
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaError.VisitorAn interface that defines how to map each variant of BetaError to a value of type T.
-
Method Summary
-
-
Method Detail
-
invalidRequest
final Optional<BetaInvalidRequestError> invalidRequest()
-
authentication
final Optional<BetaAuthenticationError> authentication()
-
billing
final Optional<BetaBillingError> billing()
-
permission
final Optional<BetaPermissionError> permission()
-
notFound
final Optional<BetaNotFoundError> notFound()
-
rateLimit
final Optional<BetaRateLimitError> rateLimit()
-
timeout
final Optional<BetaGatewayTimeoutError> timeout()
-
api
final Optional<BetaApiError> api()
-
overloaded
final Optional<BetaOverloadedError> overloaded()
-
isInvalidRequest
final Boolean isInvalidRequest()
-
isAuthentication
final Boolean isAuthentication()
-
isPermission
final Boolean isPermission()
-
isNotFound
final Boolean isNotFound()
-
isRateLimit
final Boolean isRateLimit()
-
isOverloaded
final Boolean isOverloaded()
-
asInvalidRequest
final BetaInvalidRequestError asInvalidRequest()
-
asAuthentication
final BetaAuthenticationError asAuthentication()
-
asBilling
final BetaBillingError asBilling()
-
asPermission
final BetaPermissionError asPermission()
-
asNotFound
final BetaNotFoundError asNotFound()
-
asRateLimit
final BetaRateLimitError asRateLimit()
-
asTimeout
final BetaGatewayTimeoutError asTimeout()
-
asApi
final BetaApiError asApi()
-
asOverloaded
final BetaOverloadedError asOverloaded()
-
accept
final <T extends Any> T accept(BetaError.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = betaError.accept(new BetaError.Visitor<Optional<String>>() { @Override public Optional<String> visitInvalidRequest(BetaInvalidRequestError invalidRequest) { return Optional.of(invalidRequest.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaError validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofInvalidRequest
final static BetaError ofInvalidRequest(BetaInvalidRequestError invalidRequest)
-
ofAuthentication
final static BetaError ofAuthentication(BetaAuthenticationError authentication)
-
ofBilling
final static BetaError ofBilling(BetaBillingError billing)
-
ofPermission
final static BetaError ofPermission(BetaPermissionError permission)
-
ofNotFound
final static BetaError ofNotFound(BetaNotFoundError notFound)
-
ofRateLimit
final static BetaError ofRateLimit(BetaRateLimitError rateLimit)
-
ofTimeout
final static BetaError ofTimeout(BetaGatewayTimeoutError timeout)
-
ofApi
final static BetaError ofApi(BetaApiError api)
-
ofOverloaded
final static BetaError ofOverloaded(BetaOverloadedError overloaded)
-
-
-
-