Closed mlejva closed 3 months ago
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
error.status
This is fixed in the new SDK — now we returning specific AuthenticationError.
AuthenticationError
When a user passes a wrong API key
we throw the following error signaling it's an HTTP error with status 401
but
error.status
is actually undefined