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

Add new built-in: error(msg) #1118

Merged
merged 4 commits into from
Mar 3, 2022
Merged

Add new built-in: error(msg) #1118

merged 4 commits into from
Mar 3, 2022

Conversation

chamons
Copy link
Contributor

@chamons chamons commented Feb 24, 2022

Fixes: #1073

Error will fail execution with the message given

error: Call to function `error` failed: something is wrong, yo!
   |
   24 | x := error("something is wrong, yo!")

When provided no message, it however behaves:

error: Call to function `error` failed:
   |
   24 | x := error("")

Error will fail execution with the message given

    error: Call to function `error` failed: something is wrong, yo!
       |
       24 | x := error("something is wrong, yo!")

When provided no message, it however behaves:

    error: Call to function `error` failed:
       |
       24 | x := error("")
@chamons
Copy link
Contributor Author

chamons commented Feb 24, 2022

Feel free to wordsmith the readme text as desired. I consider it a rough draft at best.

@chamons
Copy link
Contributor Author

chamons commented Feb 24, 2022

As a second comment, thinking about this, it is annoying that you have to do x := error("foo") and not just error("foo"). I'm assuming that's a general grammar issue, and not something I should fix here?

Copy link
Owner

@casey casey left a comment

Choose a reason for hiding this comment

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

Nice, looks good! A couple of comments. There should also be a new entry for the function in the functions section of the readme.

tests/functions.rs Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
@chamons
Copy link
Contributor Author

chamons commented Feb 24, 2022

I'll update the readme tonight.

@casey casey enabled auto-merge (squash) March 3, 2022 00:44
@casey
Copy link
Owner

casey commented Mar 3, 2022

Sorry for losing track of this! I don't have notifications turned on when someone pushes to a PR branch, so you have to ping me. This looks good, merging! Definitely a nice function to have.

@casey casey merged commit 7299353 into casey:master Mar 3, 2022
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.

Builtin-in function to fail/panic?
2 participants