Skip to content
View as Markdown
import "github.com/daytonaio/daytona/libs/sdk-go/pkg/errors"
func ConvertAPIError(err error, httpResp *http.Response) error

ConvertAPIError converts api-client-go errors to SDK error types

func ConvertToolboxError(err error, httpResp *http.Response) error

ConvertToolboxError converts toolbox-api-client-go errors to SDK error types

func NewDaytonaErrorFromBody(body []byte, statusCode int, headers http.Header) error

NewDaytonaErrorFromBody parses a JSON response body and maps the status code to the appropriate SDK error type. Falls back to the raw body as the message.

DaytonaError is the base error type for all Daytona SDK errors

type DaytonaError struct {
Message string
StatusCode int
Headers http.Header
}
func NewDaytonaError(message string, statusCode int, headers http.Header) *DaytonaError

NewDaytonaError creates a new DaytonaError

func (e *DaytonaError) Error() string

DaytonaNotFoundError represents a resource not found error (404)

type DaytonaNotFoundError struct {
*DaytonaError
}
func NewDaytonaNotFoundError(message string, headers http.Header) *DaytonaNotFoundError

NewDaytonaNotFoundError creates a new DaytonaNotFoundError

func (e *DaytonaNotFoundError) Error() string

DaytonaRateLimitError represents a rate limit error (429)

type DaytonaRateLimitError struct {
*DaytonaError
}
func NewDaytonaRateLimitError(message string, headers http.Header) *DaytonaRateLimitError

NewDaytonaRateLimitError creates a new DaytonaRateLimitError

func (e *DaytonaRateLimitError) Error() string

DaytonaTimeoutError represents a timeout error

type DaytonaTimeoutError struct {
*DaytonaError
}
func NewDaytonaTimeoutError(message string) *DaytonaTimeoutError

NewDaytonaTimeoutError creates a new DaytonaTimeoutError

func (e *DaytonaTimeoutError) Error() string