feat: export semantic error types and add API reference docs#1447
feat: export semantic error types and add API reference docs#1447
Conversation
🦋 Changeset detectedLatest commit: ed46864 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 packages
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 |
There was a problem hiding this comment.
Pull request overview
This PR expands the public surface area and documentation around semantic error types by re-exporting them via workflow/internal/errors, adding/standardizing world-level error classes in @workflow/errors, and introducing API reference docs for these errors. It also adds DEBUG-gated request timing logs in the Vercel world client and fixes a CLI env var passthrough.
Changes:
- Re-export semantic error types from
workflow/internal/errorsand add new world-level semantic error classes to@workflow/errors. - Add/standardize TSDoc on error classes and add API reference docs pages for the error types.
- Add DEBUG-gated HTTP timing logs in
@workflow/world-verceland passWORKFLOW_LOCAL_BASE_URLthrough CLI inspect env.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/world-vercel/src/utils.ts | Adds lightweight DEBUG-gated HTTP timing logging around fetch() requests. |
| packages/workflow/src/internal/errors.ts | Re-exports semantic/world error types from @workflow/errors via workflow/internal/errors. |
| packages/errors/src/index.ts | Adds/extends semantic error classes (world-level) and improves TSDoc consistency/examples. |
| packages/core/src/runtime/helpers.ts | Adds runtime debug logs for event pagination load timing during replay. |
| packages/cli/src/lib/inspect/env.ts | Includes WORKFLOW_LOCAL_BASE_URL in env var collection for inspect/health checks. |
| docs/content/docs/api-reference/workflow/workflow-world-error.mdx | New API reference page for WorkflowWorldError. |
| docs/content/docs/api-reference/workflow/workflow-run-not-found-error.mdx | New API reference page for WorkflowRunNotFoundError. |
| docs/content/docs/api-reference/workflow/workflow-run-failed-error.mdx | New API reference page for WorkflowRunFailedError. |
| docs/content/docs/api-reference/workflow/workflow-run-cancelled-error.mdx | New API reference page for WorkflowRunCancelledError. |
| docs/content/docs/api-reference/workflow/too-early-error.mdx | New API reference page for TooEarlyError. |
| docs/content/docs/api-reference/workflow/throttle-error.mdx | New API reference page for ThrottleError. |
| docs/content/docs/api-reference/workflow/run-expired-error.mdx | New API reference page for RunExpiredError. |
| docs/content/docs/api-reference/workflow/hook-not-found-error.mdx | New API reference page for HookNotFoundError. |
| docs/content/docs/api-reference/workflow/entity-conflict-error.mdx | New API reference page for EntityConflictError. |
| docs/content/docs/api-reference/workflow/meta.json | Adds new error reference pages to the workflow API reference sidebar. |
| .changeset/error-docs-and-exports.md | Changeset for workflow + @workflow/errors export/doc updates. |
| .changeset/early-bats-make.md | Changeset for @workflow/world-vercel DEBUG HTTP timing logs. |
| .changeset/bumpy-mice-do.md | Changeset for @workflow/cli env var passthrough fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|
|
||
| /** | ||
| * Lightweight debug logger for HTTP requests. Activated when the DEBUG | ||
| * env var includes "workflow:" (matching the standard `debug` module | ||
| * convention used by @workflow/core). | ||
| */ | ||
| const HTTP_DEBUG_ENABLED = | ||
| typeof process !== 'undefined' && | ||
| typeof process.env.DEBUG === 'string' && | ||
| (process.env.DEBUG.includes('workflow:') || process.env.DEBUG === '*'); | ||
|
|
||
| function httpLog( | ||
| method: string, | ||
| endpoint: string, | ||
| status: number, | ||
| ms: number | ||
| ): void { | ||
| if (HTTP_DEBUG_ENABLED) { | ||
| console.debug( | ||
| `[workflow:world-vercel:http] ${method} ${endpoint} -> ${status} (${ms}ms)` | ||
| ); | ||
| } | ||
| } | ||
| import { | ||
| ErrorType, | ||
| getSpanKind, |
| /** | ||
| * Lightweight debug logger for HTTP requests. Activated when the DEBUG | ||
| * env var includes "workflow:" (matching the standard `debug` module | ||
| * convention used by @workflow/core). | ||
| */ | ||
| const HTTP_DEBUG_ENABLED = | ||
| typeof process !== 'undefined' && | ||
| typeof process.env.DEBUG === 'string' && | ||
| (process.env.DEBUG.includes('workflow:') || process.env.DEBUG === '*'); |
a480112 to
cfdd0d6
Compare
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (3 failed)astro (1 failed):
hono (1 failed):
nextjs-turbopack (1 failed):
🌍 Community Worlds (56 failed)mongodb (3 failed):
redis (2 failed):
turso (51 failed):
Details by Category❌ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
Add missing error exports (HookNotFoundError, EntityConflictError, RunExpiredError, TooEarlyError, ThrottleError, RunNotSupportedError, WorkflowWorldError) to workflow/internal/errors. Create new error classes for world-level semantics. Tighten TSDoc comments on all error classes. Add API reference docs for all error types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cfdd0d6 to
ed46864
Compare
Summary
HookNotFoundError,EntityConflictError,RunExpiredError,TooEarlyError,ThrottleError,RunNotSupportedError,WorkflowWorldError) fromworkflow/internal/errors@workflow/errors:WorkflowWorldError,EntityConflictError,RunExpiredError,TooEarlyError,ThrottleError(world-level semantic errors).is()method, key properties)Test plan
pnpm buildpassespnpm typecheckpassesworkflow/internal/errorsexports are accessible at runtime🤖 Generated with Claude Code