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 conversion error messages #1141

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

0xced
Copy link
Contributor

@0xced 0xced commented Jan 24, 2023

When a conversion to an enum fails, list all the valid enum values in the error message.

Message before this commit:

Error: heimday is not a valid value for DayOfWeek.

Message after this commit:

Error: Failed to convert 'heimday' to DayOfWeek. Valid values are 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'

When a conversion to an enum fails, list all the valid enum values in the error message.

Message before this commit:
> Error: heimday is not a valid value for DayOfWeek.

Message after this commit:
> Error: Failed to convert 'heimday' to DayOfWeek. Valid values are 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
Copy link
Contributor

@patriksvensson patriksvensson left a comment

Choose a reason for hiding this comment

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

Solid feature! Looks good to me!

@patriksvensson patriksvensson merged commit beca0b2 into spectreconsole:main Jan 24, 2023
@patriksvensson
Copy link
Contributor

Merged! Thank you for your contribution. Much appreciated! 👍

@0xced 0xced deleted the better-conversion-errors branch January 24, 2023 20:19
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.

2 participants