Conversation
This returns all errors as a type from Unkey versus just one
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: ad4fbaa The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 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 |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe pull request introduces type definitions for error codes in the "@unkey/api" package. The Changes
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
packages/api/src/errors.ts (1)
4-4: Consider creating specific error types per endpointWhile adding more error types is good, deriving all error types from the
/v1/livenessendpoint might not accurately represent the error structures of other endpoints. Consider creating endpoint-specific error types if the error responses differ between endpoints.Additionally, consider refactoring this long union type for better maintainability:
-export type ErrorResponse = paths["/v1/liveness"]["get"]["responses"]["400"]["content"]["application/json"] | paths["/v1/liveness"]["get"]["responses"]["401"]["content"]["application/json"] | paths["/v1/liveness"]["get"]["responses"]["403"]["content"]["application/json"] | paths["/v1/liveness"]["get"]["responses"]["404"]["content"]["application/json"] |paths["/v1/liveness"]["get"]["responses"]["409"]["content"]["application/json"] | paths["/v1/liveness"]["get"]["responses"]["429"]["content"]["application/json"] | paths["/v1/liveness"]["get"]["responses"]["500"]["content"]["application/json"] +type BaseErrorPath = paths["/v1/liveness"]["get"]["responses"] +export type ErrorResponse = + | BaseErrorPath["400"]["content"]["application/json"] + | BaseErrorPath["401"]["content"]["application/json"] + | BaseErrorPath["403"]["content"]["application/json"] + | BaseErrorPath["404"]["content"]["application/json"] + | BaseErrorPath["409"]["content"]["application/json"] + | BaseErrorPath["429"]["content"]["application/json"] + | BaseErrorPath["500"]["content"]["application/json"].changeset/twelve-kiwis-live.md (1)
5-5: Enhance the changeset descriptionConsider adding more details about the specific error codes added and the benefits this brings to SDK users.
-Add the types for error codes +Add comprehensive error type definitions (400, 401, 403, 404, 409, 429, 500) to improve type safety and error handling in the SDK
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.changeset/twelve-kiwis-live.md(1 hunks)packages/api/src/errors.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (17)
- GitHub Check: Test Packages / Test ./packages/rbac
- GitHub Check: Test Packages / Test ./packages/nextjs
- GitHub Check: Test Packages / Test ./packages/hono
- GitHub Check: Test Packages / Test ./packages/cache
- GitHub Check: Test Packages / Test ./packages/api
- GitHub Check: Test Packages / Test ./internal/clickhouse
- GitHub Check: Test Packages / Test ./internal/resend
- GitHub Check: Test Packages / Test ./internal/keys
- GitHub Check: Test Packages / Test ./internal/id
- GitHub Check: Test Packages / Test ./internal/hash
- GitHub Check: Test Packages / Test ./internal/encryption
- GitHub Check: Test Packages / Test ./internal/billing
- GitHub Check: Test API / API Test Local
- GitHub Check: Test Agent Local / test_agent_local
- GitHub Check: autofix
- GitHub Check: Build / Build
- GitHub Check: Analyze (javascript-typescript)
What does this PR do?
This adds all error codes as types versus just the 500
Fixes # (issue)
Fixed reported bug by user in Discord
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit
New Features
Refactor