Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Improve CLI error messages
Tomas Valentaf6280d1311f7
diff --git a/.changeset/famous-spoons-share.md b/.changeset/famous-spoons-share.mdnew file mode 100644index 000000000..e62ffd44f--- /dev/null+++ b/.changeset/famous-spoons-share.md@@ -0,0 +1,5 @@+---+"@e2b/cli": patch+---++Improve error messagesdiff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.tsindex f149e07fd..70fc97c60 100644--- a/packages/cli/src/commands/build.ts+++ b/packages/cli/src/commands/build.ts@@ -176,7 +176,7 @@ export const buildCommand = new commander.Command('build')body.append('startCmd', startCmd)}- const build = await buildTemplate(accessToken, body, envID)+ const build = await buildTemplate(accessToken, body, !!config, configPath, envID)console.log(`Started building the sandbox template ${asFormattedSandboxTemplate(@@ -377,6 +377,8 @@ function getDockerfile(root: string, file?: string) {async function buildTemplate(accessToken: string,body: FormData,+ hasConfig: boolean,+ configPath: string,envID?: string,): Promise<Omit<@@ -413,6 +415,13 @@ async function buildTemplate()}+ if (error.code === 404) {+ throw new Error(+ `Sandbox template you want to build ${envID ? `(${envID})` : ''} not found: ${res.statusText}, ${error.message ?? 'no message'+ }\n${hasConfig ? `This could be caused by ${asLocalRelative(configPath)} belonging to a deleted template or a template that you don't own. If so you can delete the ${asLocalRelative(configPath)} and start building the template again.` : ''}`,+ )+ }+if (error.code === 500) {throw new Error(`Server error: ${res.statusText}, ${error.message ?? 'no message'}`,