[code-infra] Migrate error code extraction to code-infra#2670
Merged
brijeshb42 merged 11 commits intomui:masterfrom Oct 16, 2025
Merged
[code-infra] Migrate error code extraction to code-infra#2670brijeshb42 merged 11 commits intomui:masterfrom
brijeshb42 merged 11 commits intomui:masterfrom
Conversation
brijeshb42
commented
Sep 5, 2025
| selector = a; | ||
| } else { | ||
| throw new Error('Missing arguments'); | ||
| throw /* minify-error-disabled */ new Error('Missing arguments'); |
Contributor
Author
There was a problem hiding this comment.
Doesn't really save that much.
commit: |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
brijeshb42
commented
Sep 5, 2025
| case 3: return fn(state, a1, a2, a3); | ||
| default: | ||
| throw new Error('unreachable'); | ||
| throw /* minify-error-disabled */ new Error('unreachable'); |
| * ... | ||
| */ | ||
| export default function formatErrorMessage(code: number, ...args: string[]): string { | ||
| const url = new URL(`https://base-ui.com/production-error/${code}`); |
Contributor
Author
There was a problem hiding this comment.
It can be this or https://base-ui.com/production-error?code=${code}
| if (process.env.NODE_ENV !== 'production') { | ||
| throw new Error('Base UI: Cannot call an event handler while rendering.'); | ||
| } | ||
| throw new Error('Base UI: Cannot call an event handler while rendering.'); |
Contributor
Author
There was a problem hiding this comment.
NODE_ENV check not needed now with extraction enabled.
1516364 to
10cb971
Compare
Bundle size report
|
d936046 to
2dbc69c
Compare
604f17f to
3e1029c
Compare
3e1029c to
4a7124d
Compare
4a7124d to
187001a
Compare
187001a to
43d8fdd
Compare
brijeshb42
commented
Oct 10, 2025
| 'use client'; | ||
| import * as React from 'react'; | ||
| import { useSearchParams } from 'next/navigation'; | ||
| import codes from 'docs/src/error-codes.json'; |
Contributor
Author
There was a problem hiding this comment.
We can have basic inline markdown formatting rendering in a followup.
Janpot
reviewed
Oct 15, 2025
| @@ -46,6 +46,8 @@ function createStableCallback() { | |||
|
|
|||
| function assertNotCalled() { | |||
| if (process.env.NODE_ENV !== 'production') { | |||
Member
There was a problem hiding this comment.
🤔 That's a case we may be able to detect in the babel plugin
e6da500 to
0a4803a
Compare
0a4803a to
4e1c986
Compare
Contributor
Author
|
@mui/base-ui Can I get a review/approval ? |
LukasTy
approved these changes
Oct 15, 2025
Comment on lines
+32
to
+33
| 1. There hasn't been an update to the semantic meaning of the error message. Error codes need to outlive Base UI versions, so the same code must mean the same thing across versions. | ||
| 2. There hasn't been a change in parameters, no added and no removed. |
Member
There was a problem hiding this comment.
Won't this be "hardish" to maintain without automation as time goes by? 🤔
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://deploy-preview-2670--base-ui.netlify.app/production-error?code=1