Skip to content
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

[charts] Make error message more explicit #11457

Merged
merged 5 commits into from
Dec 21, 2023

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Dec 19, 2023

This improvement the charts error message in 3 ways (one per commit):

  • Use the prefix MUI-Charts: to distinguish error messages that are charts from those coming from other MUI dependencies.
  • Provide the array of available axes ids when the provided id is not found, to quickly know if it's a typo or a more serious error.
  • Adapt the error message when the axis id is not specified by the user. It's frequent with composition to get an error Axis of id "DEFAULT_X_AXIS_KEY" should be ... which makes no sense for a new user.

@alexfauquette alexfauquette added component: charts This is the name of the generic UI component, not the React module! dx Related to developers' experience labels Dec 19, 2023
@mui-bot
Copy link

mui-bot commented Dec 19, 2023

Deploy preview: https://deploy-preview-11457--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 8e7bd5c

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Very nice DX improvement! 👍

@@ -97,22 +98,42 @@ const useCompletedData = (): CompletedBarData[] => {
if (verticalLayout) {
if (!isBandScaleConfig(xAxisConfig)) {
throw new Error(
`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`,
`MUI-Charts: ${
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Have you considered going with a MUI-X-Charts prefix instead to be more explicit/correct? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

No, but it's a good idea :)

@alexfauquette alexfauquette merged commit bffa6fc into mui:next Dec 21, 2023
17 checks passed
alexfauquette added a commit to alexfauquette/mui-x that referenced this pull request Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! dx Related to developers' experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants