Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Updated `Template.aliasExists` error type (#1079)

Mish Ushakov31670f4068df
diff --git a/.changeset/public-views-roll.md b/.changeset/public-views-roll.md
new file mode 100644
index 000000000..bd07f4117
--- /dev/null
+++ b/.changeset/public-views-roll.md
@@ -0,0 +1,6 @@
+---
+'@e2b/python-sdk': patch
+'e2b': patch
+---
+
+updates template alias error type
diff --git a/packages/js-sdk/src/template/buildApi.ts b/packages/js-sdk/src/template/buildApi.ts
index 75d15df0e..c5e8ebbbb 100644
--- a/packages/js-sdk/src/template/buildApi.ts
+++ b/packages/js-sdk/src/template/buildApi.ts
@@ -1,6 +1,6 @@
import { ApiClient, handleApiError, paths } from '../api'
import { stripAnsi } from '../utils'
-import { BuildError, FileUploadError } from '../errors'
+import { BuildError, FileUploadError, TemplateError } from '../errors'
import { LogEntry } from './logger'
import { getBuildStepIndex, tarFileStreamUpload } from './utils'
@@ -212,7 +212,7 @@ export async function checkAliasExists(
}
// Handle other errors
- const error = handleApiError(aliasRes, BuildError)
+ const error = handleApiError(aliasRes, TemplateError)
if (error) {
throw error
}
diff --git a/packages/python-sdk/e2b/template_async/build_api.py b/packages/python-sdk/e2b/template_async/build_api.py
index f8f9924d1..84d3672e5 100644
--- a/packages/python-sdk/e2b/template_async/build_api.py
+++ b/packages/python-sdk/e2b/template_async/build_api.py
@@ -20,7 +20,7 @@ from e2b.api.client.models import (
TemplateBuild,
Error,
)
-from e2b.exceptions import BuildException, FileUploadException
+from e2b.exceptions import BuildException, FileUploadException, TemplateException
from e2b.template.logger import LogEntry
from e2b.template.types import TemplateType
from e2b.template.utils import get_build_step_index, tar_file_stream
@@ -229,7 +229,7 @@ async def check_alias_exists(client: AuthenticatedClient, alias: str) -> bool:
# Handle other errors
if res.status_code >= 300:
- raise handle_api_exception(res, BuildException)
+ raise handle_api_exception(res, TemplateException)
# If we get Ok with data, you are owner and the alias exists
return res.parsed is not None
diff --git a/packages/python-sdk/e2b/template_sync/build_api.py b/packages/python-sdk/e2b/template_sync/build_api.py
index 4d560b21d..459243430 100644
--- a/packages/python-sdk/e2b/template_sync/build_api.py
+++ b/packages/python-sdk/e2b/template_sync/build_api.py
@@ -20,7 +20,7 @@ from e2b.api.client.models import (
TemplateBuild,
Error,
)
-from e2b.exceptions import BuildException, FileUploadException
+from e2b.exceptions import BuildException, FileUploadException, TemplateException
from e2b.template.logger import LogEntry
from e2b.template.types import TemplateType
from e2b.template.utils import get_build_step_index, tar_file_stream
@@ -226,7 +226,7 @@ def check_alias_exists(client: AuthenticatedClient, alias: str) -> bool:
# Handle other errors
if res.status_code >= 300:
- raise handle_api_exception(res, BuildException)
+ raise handle_api_exception(res, TemplateException)
# If we get Ok with data, you are owner and the alias exists
return res.parsed is not None