Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return correct status code in error.status when passing a wrong API key #358

Open
mlejva opened this issue Apr 17, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@mlejva
Copy link
Member

mlejva commented Apr 17, 2024

When a user passes a wrong API key

try {
    const sandbox = await Sandbox.create({
        apiKey: 'wrong-api-key'
    })
  } catch (error) {
    console.error(error)
    console.error(error.status)
  }

we throw the following error signaling it's an HTTP error with status 401

Error: Error creating sandbox - (401) unauthenticated: Invalid API key, please visit https://e2b.dev/docs?reason=sdk-missing-api-key to get your API key.

but error.status is actually undefined

@mlejva mlejva added the bug Something isn't working label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant