Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/js-sdk/src/envd/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
InvalidArgumentError,
NotFoundError,
NotEnoughSpaceError,
RateLimitError,
formatSandboxTimeoutError,
AuthenticationError,
} from '../errors'
Expand Down Expand Up @@ -38,7 +39,7 @@ export async function handleEnvdApiError(res: {
case 404:
return new NotFoundError(message)
case 429:
return new SandboxError(
return new RateLimitError(
`${res.response.status}: ${message}: The requests are being rate limited.`
)
case 502:
Expand Down
5 changes: 5 additions & 0 deletions packages/js-sdk/src/envd/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
formatSandboxTimeoutError,
InvalidArgumentError,
NotFoundError,
RateLimitError,
SandboxError,
TimeoutError,
} from '../errors'
Expand All @@ -24,6 +25,10 @@ export function handleRpcError(err: unknown): Error {
return new NotFoundError(err.message)
case Code.Unavailable:
return formatSandboxTimeoutError(err.message)
case Code.ResourceExhausted:
return new RateLimitError(
`${err.message}: Rate limit exceeded, please try again later.`
)
case Code.Canceled:
return new TimeoutError(
`${err.message}: This error is likely due to exceeding 'requestTimeoutMs'. You can pass the request timeout value as an option when making the request.`
Expand Down
2 changes: 2 additions & 0 deletions packages/python-sdk/e2b/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
InvalidArgumentException,
NotEnoughSpaceException,
NotFoundException,
RateLimitException,
SandboxException,
TemplateException,
TimeoutException,
Expand Down Expand Up @@ -127,6 +128,7 @@
"GitUpstreamException",
"InvalidArgumentException",
"NotEnoughSpaceException",
"RateLimitException",
"TemplateException",
"BuildException",
"FileUploadException",
Expand Down
3 changes: 2 additions & 1 deletion packages/python-sdk/e2b/envd/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
AuthenticationException,
InvalidArgumentException,
NotEnoughSpaceException,
RateLimitException,
format_sandbox_timeout_exception,
)

Expand Down Expand Up @@ -50,7 +51,7 @@ def format_envd_api_exception(status_code: int, message: str):
elif status_code == 404:
return NotFoundException(message)
elif status_code == 429:
return SandboxException(f"{message}: The requests are being rate limited.")
return RateLimitException(f"{message}: The requests are being rate limited.")
elif status_code == 502:
return format_sandbox_timeout_exception(message)
elif status_code == 507:
Expand Down