このコンテンツはまだ日本語訳がありません。
DaytonaException
Section titled “DaytonaException”Base exception for all Daytona SDK errors.
Subclasses map to specific HTTP status codes and allow callers to catch precise failure conditions without string-parsing error messages:
try {Sandbox sandbox = daytona.sandbox().get("nonexistent-id");} catch (DaytonaNotFoundException e) {// sandbox does not exist} catch (DaytonaAuthenticationException e) {// invalid API key} catch (DaytonaException e) {// other SDK error}Constructors
Section titled “Constructors”new DaytonaException()
Section titled “new DaytonaException()”public DaytonaException(String message)Creates a generic Daytona exception.
Parameters:
messageString - error description
new DaytonaException()
Section titled “new DaytonaException()”public DaytonaException(String message, Throwable cause)Creates a generic Daytona exception with a cause.
Parameters:
messageString - error descriptioncauseThrowable - root cause
new DaytonaException()
Section titled “new DaytonaException()”public DaytonaException(int statusCode, String message)Creates a Daytona exception with explicit HTTP status code.
Parameters:
statusCodeint - HTTP status codemessageString - error description
new DaytonaException()
Section titled “new DaytonaException()”public DaytonaException(int statusCode, String message, Map<String, String> headers)Creates a Daytona exception with HTTP status code and headers.
Parameters:
statusCodeint - HTTP status codemessageString - error descriptionheadersMap<String, String> - response headers
Methods
Section titled “Methods”getStatusCode()
Section titled “getStatusCode()”public int getStatusCode()Returns the HTTP status code, or 0 if not applicable.
Returns:
int-
getHeaders()
Section titled “getHeaders()”public Map<String, String> getHeaders()Returns the HTTP response headers, or an empty map if not available.
Returns:
Map\<String, String\>-
DaytonaAuthenticationException
Section titled “DaytonaAuthenticationException”Raised when API credentials are missing or invalid (HTTP 401).
try {daytona.sandbox().create();} catch (DaytonaAuthenticationException e) {System.err.println("Invalid or missing API key");}Constructors
Section titled “Constructors”new DaytonaAuthenticationException()
Section titled “new DaytonaAuthenticationException()”public DaytonaAuthenticationException(String message)Creates an authentication exception.
Parameters:
messageString - error description from the API
DaytonaBadRequestException
Section titled “DaytonaBadRequestException”Raised when the request is malformed or contains invalid parameters (HTTP 400).
try {daytona.sandbox().create(params);} catch (DaytonaBadRequestException e) {System.err.println("Invalid request parameters: " + e.getMessage());}Constructors
Section titled “Constructors”new DaytonaBadRequestException()
Section titled “new DaytonaBadRequestException()”public DaytonaBadRequestException(String message)Creates a bad-request exception.
Parameters:
messageString - error description from the API
DaytonaConflictException
Section titled “DaytonaConflictException”Raised when an operation conflicts with the current state (HTTP 409).
Common causes: creating a resource with a name that already exists, or performing an operation incompatible with the resource’s current state.
try {daytona.snapshot().create(params);} catch (DaytonaConflictException e) {System.err.println("A snapshot with this name already exists");}Constructors
Section titled “Constructors”new DaytonaConflictException()
Section titled “new DaytonaConflictException()”public DaytonaConflictException(String message)Creates a conflict exception.
Parameters:
messageString - error description from the API
DaytonaConnectionException
Section titled “DaytonaConnectionException”Raised for network-level connection failures (no HTTP response received).
Raised when the SDK cannot reach the Daytona API due to network issues such as DNS failure, connection refused, or TLS errors.
try {daytona.sandbox().create();} catch (DaytonaConnectionException e) {System.err.println("Cannot reach Daytona API: " + e.getMessage());}Constructors
Section titled “Constructors”new DaytonaConnectionException()
Section titled “new DaytonaConnectionException()”public DaytonaConnectionException(String message)Creates a connection exception.
Parameters:
messageString - connection failure description
new DaytonaConnectionException()
Section titled “new DaytonaConnectionException()”public DaytonaConnectionException(String message, Throwable cause)Creates a connection exception with a cause.
Parameters:
messageString - connection failure descriptioncauseThrowable - root cause
DaytonaForbiddenException
Section titled “DaytonaForbiddenException”Raised when the authenticated user lacks permission to perform an operation (HTTP 403).
try {daytona.sandbox().delete(sandboxId);} catch (DaytonaForbiddenException e) {System.err.println("Not authorized to delete this sandbox");}Constructors
Section titled “Constructors”new DaytonaForbiddenException()
Section titled “new DaytonaForbiddenException()”public DaytonaForbiddenException(String message)Creates a forbidden exception.
Parameters:
messageString - error description from the API
DaytonaNotFoundException
Section titled “DaytonaNotFoundException”Raised when a requested resource does not exist (HTTP 404).
Constructors
Section titled “Constructors”new DaytonaNotFoundException()
Section titled “new DaytonaNotFoundException()”public DaytonaNotFoundException(String message)Creates a not-found exception.
Parameters:
messageString - error description from the API
DaytonaRateLimitException
Section titled “DaytonaRateLimitException”Raised when API rate limits are exceeded (HTTP 429).
Constructors
Section titled “Constructors”new DaytonaRateLimitException()
Section titled “new DaytonaRateLimitException()”public DaytonaRateLimitException(String message)Creates a rate-limit exception.
Parameters:
messageString - error description from the API
DaytonaServerException
Section titled “DaytonaServerException”Raised for unexpected server-side failures (HTTP 5xx).
These are typically transient and safe to retry with exponential backoff.
try {daytona.sandbox().create();} catch (DaytonaServerException e) {System.err.println("Server error (status " + e.getStatusCode() + "), retry later");}Constructors
Section titled “Constructors”new DaytonaServerException()
Section titled “new DaytonaServerException()”public DaytonaServerException(int statusCode, String message)Creates a server exception.
Parameters:
statusCodeint - HTTP status code (typically 5xx)messageString - error description from the API
DaytonaTimeoutException
Section titled “DaytonaTimeoutException”Raised when an SDK operation times out.
This exception is generated client-side and is not tied to a single HTTP status code.
Constructors
Section titled “Constructors”new DaytonaTimeoutException()
Section titled “new DaytonaTimeoutException()”public DaytonaTimeoutException(String message, Throwable cause)Creates a timeout exception with a cause.
Parameters:
messageString - timeout descriptioncauseThrowable - root cause
new DaytonaTimeoutException()
Section titled “new DaytonaTimeoutException()”public DaytonaTimeoutException(String message)Creates a timeout exception.
Parameters:
messageString - timeout description
DaytonaValidationException
Section titled “DaytonaValidationException”Raised for semantic validation failures (HTTP 422).
Raised when the request is well-formed but the values fail business logic validation (e.g., unsupported resource class, invalid configuration).
try {daytona.sandbox().create(params);} catch (DaytonaValidationException e) {System.err.println("Validation failed: " + e.getMessage());}Constructors
Section titled “Constructors”new DaytonaValidationException()
Section titled “new DaytonaValidationException()”public DaytonaValidationException(String message)Creates a validation exception.
Parameters:
messageString - error description from the API