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

Improved various error messages when handling unexpected types. #1152

Merged
merged 2 commits into from May 23, 2023

Conversation

zevv
Copy link
Contributor

@zevv zevv commented May 22, 2023

error: bad slot #1, expected string|symbol|keyword|buffer, got ...
error: bad slot #1, expected a string, symbol, keyword or buffer, got ...
bad s64 initializer: "donkey"
can not convert string "donkey" to s64

In other places error message do not talk about "s64" but about "64 bit signed integer", would that be preferable here as well?

@zevv zevv force-pushed the error-messages branch 3 times, most recently from b14ce95 to 039903e Compare May 22, 2023 18:43
@bakpakin
Copy link
Member

The pipe syntax for a type union may appear in other places in the code, but since the new message is very clear, I don't think this will cause more confusion. These error messages are certainly no worse - as far s64 vs. "64 bit signed integer", I don't mind either way but if we are going the route of having as simple, readable prose as possible for error messages, "64 bit signed integer" is definitely better.

zevv added 2 commits May 23, 2023 06:57
error: bad slot janet-lang#1, expected string|symbol|keyword|buffer, got ...
error: bad slot janet-lang#1, expected a string, symbol, keyword or buffer, got ...

bad s64 initializer: "donkey"
can not convert string "donkey" to s64
@bakpakin bakpakin merged commit e6b7c85 into janet-lang:master May 23, 2023
7 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.

None yet

2 participants