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

(env) add Ensure module for argument validation #13

Merged
merged 8 commits into from
Sep 22, 2021
Merged

(env) add Ensure module for argument validation #13

merged 8 commits into from
Sep 22, 2021

Conversation

joshgoebel
Copy link
Owner

No description provided.

@glennj
Copy link
Collaborator

glennj commented Sep 18, 2021

This is nice.

Comment on lines 1 to 11
class Error {
toString { message }
raise() { Fiber.abort(this) }
}

class ArgumentError is Error {
construct new(message) {
_message = message
}
message { _message }
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This kind of exception hierarchy is clearly something we want in Wren. It could be moved to its own module.

import "errors" for ArgumentError

Which will make it easy to extend

import "errors" for Error
class MyError {
  construct new() {}
  message { "My errors have a constant error message." }
}
```

Copy link
Owner Author

Choose a reason for hiding this comment

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

That's where I'm headed, one thing at a time. :-)

@joshgoebel joshgoebel changed the title add Enforce module (env) add Ensure module for argument validation Sep 22, 2021
@clsource
Copy link

Super cool 👍

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