-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: export egg/errors
#5655
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
feat: export egg/errors
#5655
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for exporting the @eggjs/errors package through the main egg package by creating a new errors.ts entry point. This allows consumers to import error types directly from egg/errors rather than having to import from @eggjs/errors directly.
Key Changes:
- Created a new
errors.tsfile that re-exports everything from@eggjs/errors - Added corresponding package.json export entries for both TypeScript and JavaScript consumers
- Added
@eggjs/errorsas a workspace dependency
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/egg/src/errors.ts | New file that re-exports all exports from @eggjs/errors |
| packages/egg/package.json | Added export entries for ./errors and added @eggjs/errors dependency (also alphabetized dependencies) |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Summary of ChangesHello @fengmk2, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature that exports the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a public Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request adds a new export for egg/errors by re-exporting from the @eggjs/errors package. The implementation is straightforward and correct. I have one suggestion regarding the dependency versioning in package.json to improve consistency and stability.
packages/egg/package.json
Outdated
| "@eggjs/core": "workspace:*", | ||
| "@eggjs/dal-plugin": "workspace:*", | ||
| "@eggjs/development": "workspace:*", | ||
| "@eggjs/errors": "workspace:^", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other workspace dependencies in this package, it's recommended to use workspace:* instead of workspace:^. Using workspace:* ensures that the exact version from the workspace is used when publishing. This provides more stability for a framework package like egg, as workspace:^ would be translated to a ^ version range on publish, potentially pulling in newer, incompatible minor versions of @eggjs/errors.
"@eggjs/errors": "workspace:*"
Deploying egg with
|
| Latest commit: |
e14f971
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://391781ed.egg-cci.pages.dev |
| Branch Preview URL: | https://export-egg-errors.egg-cci.pages.dev |
Deploying egg-v3 with
|
| Latest commit: |
e14f971
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c7f413c9.egg-v3.pages.dev |
| Branch Preview URL: | https://export-egg-errors.egg-v3.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
packages/egg/package.json(3 hunks)packages/egg/src/errors.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use TypeScript for all source files in packages (no JavaScript source files)
Files:
packages/egg/src/errors.ts
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
packages/egg/src/errors.ts
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**,plugins/**,tools/!(egg-bin)/**}/**/*.ts: For isolatedDeclarations support, all exported functions/methods/getters must have explicit return type annotations
Avoid computed property names with symbols in class declarations (no get SYM)
Add explicit type annotations for class properties when needed (no inferred exported property types)
Exported symbols must use unique symbol type (e.g., export const X: unique symbol = Symbol('x'))
Files:
packages/egg/src/errors.ts
packages/*/package.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use "workspace:*" for internal workspace dependencies in package.json
Files:
packages/egg/package.json
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")
Files:
packages/egg/package.json
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}: Use workspace:* for internal dependencies between monorepo packages
Use catalog: versions for external dependencies defined in pnpm-workspace.yaml
Include script "typecheck": "tsc --noEmit" in all packages
Include script "lint": "oxlint --type-aware" in all packages
Include script "lint:fix" that runs oxlint with --fix (e.g., "pnpm run lint -- --fix")
Files:
packages/egg/package.json
🧠 Learnings (5)
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Use Egg.js >= 4.1.0
Applied to files:
packages/egg/src/errors.ts
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to plugins/*/package.json : Plugins must declare peerDependencies: { "egg": "workspace:*" }
Applied to files:
packages/egg/package.json
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/plugin/*/package.json : Plugin packages must define eggPlugin in package.json with dependencies
Applied to files:
packages/egg/package.json
📚 Learning: 2025-10-23T17:37:37.549Z
Learnt from: CR
PR: eggjs/egg#0
File: tegg/CLAUDE.md:0-0
Timestamp: 2025-10-23T17:37:37.549Z
Learning: Applies to tegg/{core,plugin,standalone}/*/package.json : Use workspace:* for internal monorepo dependencies and catalog: for external dependencies
Applied to files:
packages/egg/package.json
📚 Learning: 2025-10-18T11:59:58.226Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-18T11:59:58.226Z
Learning: Applies to {packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Use workspace:* for internal dependencies between monorepo packages
Applied to files:
packages/egg/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Socket Security: Pull Request Alerts
- GitHub Check: Test (macos-latest, 24, 1/5)
- GitHub Check: Test (macos-latest, 22, 1/5)
- GitHub Check: Test bin (windows-latest, 22, 1/3)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Test bin (windows-latest, 22, 0/3)
- GitHub Check: Test scripts (ubuntu-latest, 22)
- GitHub Check: typecheck
- GitHub Check: Test scripts (ubuntu-latest, 24)
🔇 Additional comments (2)
packages/egg/src/errors.ts (1)
1-1: LGTM!Clean barrel re-export that delegates to @eggjs/errors. Follows ESM conventions and aligns with the PR objective to expose the errors module.
packages/egg/package.json (1)
29-29: Exports properly aligned.The addition of
"./errors"to bothpublishConfig.exportsandexportscorrectly exposes the errors module for both distribution and source entry points, maintaining consistency with the package API surface.Also applies to: 87-87
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #5655 +/- ##
==========================================
- Coverage 87.68% 87.67% -0.01%
==========================================
Files 565 565
Lines 11010 11010
Branches 1243 1243
==========================================
- Hits 9654 9653 -1
- Misses 1275 1276 +1
Partials 81 81 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

Summary by CodeRabbit
New Features
Chores