Skip to content

Export SDK error classes from @cloudflare/sandbox root#518

Open
zllovesuki wants to merge 1 commit intocloudflare:mainfrom
zllovesuki:export-sdk-errors
Open

Export SDK error classes from @cloudflare/sandbox root#518
zllovesuki wants to merge 1 commit intocloudflare:mainfrom
zllovesuki:export-sdk-errors

Conversation

@zllovesuki
Copy link
Copy Markdown

@zllovesuki zllovesuki commented Mar 25, 2026

Summary

Fixes #517.

The published package already contains the SDK's concrete error classes internally, but the root @cloudflare/sandbox entrypoint did not re-export many of them. That made exact error handling awkward for consumers because instanceof checks from the package root failed at import time.

This PR makes the root package export the full existing SDK error-class surface, including:

  • SandboxError
  • SessionAlreadyExistsError
  • SessionDestroyedError
  • ProcessNotFoundError

and the rest of the concrete SDK error classes already exposed by the internal errors barrel.

Changes

  • re-export all existing SDK error classes from @cloudflare/sandbox
  • add a regression test to verify the root exports match the internal errors barrel
  • add a patch changeset

Result

Consumers can now do:

import { SessionAlreadyExistsError } from "@cloudflare/sandbox";

if (error instanceof SessionAlreadyExistsError) {
  // ...
}

Testing

  • npm run check
  • npm test -w @cloudflare/sandbox

npm run check still reports two existing Biome warnings in packages/sandbox-container tests, but the command completes successfully.


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 25, 2026

🦋 Changeset detected

Latest commit: 6cc1995

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@scuffi scuffi added the ok-to-test Maintainer-approved: run full CI on fork PR label Mar 25, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/sandbox-sdk/@cloudflare/sandbox@518

commit: 6cc1995

@github-actions
Copy link
Copy Markdown
Contributor

📦 Preview Build

Version: 0.0.0-pr-518-6cc1995

Install the SDK preview:

npm i https://pkg.pr.new/cloudflare/sandbox-sdk/@cloudflare/sandbox@518

🐳 Docker images were not rebuilt — no container changes detected. Use the latest release images from Docker Hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Maintainer-approved: run full CI on fork PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@cloudflare/sandbox@0.7.20 does not export concrete error classes like SessionAlreadyExistsError / SessionDestroyedError / ProcessNotFoundError

2 participants