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

Improve clarity of error messages for unknown record fields. #3964

Merged
merged 1 commit into from
Dec 7, 2024

Conversation

tubedude
Copy link
Contributor

@tubedude tubedude commented Dec 6, 2024

Hey Louis and team.

I'm made some small changes to the error messages on Custom Types to make them clearer and more consistent.

Most importantly, inserting this one:

The field you are trying to access is not defined consistently across all variants of this custom type. To fix this, ensure that all variants include the field with the same name, position, and type.

Instead of this one:

The field you are trying to access exists, but not on the variant which this value always is. A field that is not present in all variants can only be accessed when the value is inferred to be one variant.

The goal was to reduce ambiguity and provide more actionable guidance. Let me know if you have any feedback!

Thanks,

@GearsDatapacks
Copy link
Member

Ah brilliant! I'm not very good at writing error messages so I'm glad someone stepped in to help :)

Copy link
Member

@lpil lpil left a comment

Choose a reason for hiding this comment

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

Lovely! Thank you!

@lpil lpil merged commit b96a39c into gleam-lang:main Dec 7, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants