Skip to content
View as Markdown

DaytonaAuthenticationError

Error thrown when authentication fails (HTTP 401).

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await daytona.list()
} catch (error) {
if (error instanceof DaytonaAuthenticationError) {
console.log(error.statusCode)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaAuthenticationError()

new DaytonaAuthenticationError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaAuthenticationError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaAuthenticationError
Inherited from

DaytonaError.constructor

DaytonaAuthorizationError

Error thrown when the request is forbidden (HTTP 403).

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await daytona.get('sandbox-without-access')
} catch (error) {
if (error instanceof DaytonaAuthorizationError) {
console.log(error.message)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaAuthorizationError()

new DaytonaAuthorizationError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaAuthorizationError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaAuthorizationError
Inherited from

DaytonaError.constructor

DaytonaConflictError

Error thrown when a resource conflict occurs (HTTP 409).

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await daytona.create({ name: 'existing-sandbox' })
} catch (error) {
if (error instanceof DaytonaConflictError) {
console.log(error.errorCode)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaConflictError()

new DaytonaConflictError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaConflictError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaConflictError
Inherited from

DaytonaError.constructor

DaytonaConnectionError

Error thrown when a network connection fails.

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await ptyHandle.waitForConnection()
} catch (error) {
if (error instanceof DaytonaConnectionError) {
console.log(error.message)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaConnectionError()

new DaytonaConnectionError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaConnectionError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaConnectionError
Inherited from

DaytonaError.constructor

DaytonaError

Base error for Daytona SDK.

Properties:

  • errorCode? string - Machine-readable error code if available
  • headers? AxiosHeaders - Response headers if available
  • statusCode? number - HTTP status code if available

Example:

try {
await daytona.get('missing-sandbox')
} catch (error) {
if (error instanceof DaytonaError) {
console.log(error.statusCode)
console.log(error.errorCode)
console.log(error.message)
}
}

Extends:

  • Error

Extended by

  • DaytonaNotFoundError
  • DaytonaRateLimitError
  • DaytonaAuthenticationError
  • DaytonaAuthorizationError
  • DaytonaConflictError
  • DaytonaValidationError
  • DaytonaTimeoutError
  • DaytonaConnectionError

Constructors

new DaytonaError()

new DaytonaError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaError
Overrides
Error.constructor

DaytonaNotFoundError

Error thrown when a resource is not found (HTTP 404).

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await sandbox.fs.downloadFile('/workspace/missing.txt')
} catch (error) {
if (error instanceof DaytonaNotFoundError) {
console.log(error.statusCode)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaNotFoundError()

new DaytonaNotFoundError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaNotFoundError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaNotFoundError
Inherited from

DaytonaError.constructor

DaytonaRateLimitError

Error thrown when rate limit is exceeded.

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await daytona.list()
} catch (error) {
if (error instanceof DaytonaRateLimitError) {
console.log(error.errorCode)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaRateLimitError()

new DaytonaRateLimitError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaRateLimitError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaRateLimitError
Inherited from

DaytonaError.constructor

DaytonaTimeoutError

Error thrown when a timeout occurs.

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
await sandbox.waitUntilStarted(1)
} catch (error) {
if (error instanceof DaytonaTimeoutError) {
console.log(error.message)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaTimeoutError()

new DaytonaTimeoutError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaTimeoutError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaTimeoutError
Inherited from

DaytonaError.constructor

DaytonaValidationError

Error thrown when input validation fails (HTTP 400 or client-side validation).

Properties:

  • errorCode? string - Machine-readable error code if available

    • Inherited from: DaytonaError.errorCode
  • headers? AxiosHeaders - Response headers if available

    • Inherited from: DaytonaError.headers
  • statusCode? number - HTTP status code if available

    • Inherited from: DaytonaError.statusCode

Example:

try {
Image.debianSlim('3.8' as never)
} catch (error) {
if (error instanceof DaytonaValidationError) {
console.log(error.message)
}
}

Extends:

  • DaytonaError

Constructors

new DaytonaValidationError()

new DaytonaValidationError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaValidationError

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaValidationError
Inherited from

DaytonaError.constructor

createAxiosDaytonaError()

function createAxiosDaytonaError(error: AxiosError): DaytonaError

Creates the appropriate Daytona error subclass from an Axios error.

Parameters:

  • error AxiosError

Returns:

  • DaytonaError

createDaytonaError()

function createDaytonaError(
message: string,
statusCode?: number,
headers?: AxiosHeaders,
errorCode?: string): DaytonaError

Creates the appropriate Daytona error subclass from structured error metadata.

Parameters:

  • message string
  • statusCode? number
  • headers? AxiosHeaders
  • errorCode? string

Returns:

  • DaytonaError

errorClassFromStatusCode()

function errorClassFromStatusCode(statusCode?: number): typeof DaytonaError

Maps an HTTP status code to the corresponding Daytona error class.

Parameters:

  • statusCode? number

Returns

typeof DaytonaError


ResponseHeaders

type ResponseHeaders = InstanceType<typeof AxiosHeaders>;