-
Notifications
You must be signed in to change notification settings - Fork 6
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
Conversation
This is nice. |
src/module/enforce.wren
Outdated
class Error { | ||
toString { message } | ||
raise() { Fiber.abort(this) } | ||
} | ||
|
||
class ArgumentError is Error { | ||
construct new(message) { | ||
_message = message | ||
} | ||
message { _message } | ||
} |
There was a problem hiding this comment.
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." }
}
```
There was a problem hiding this comment.
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. :-)
Super cool 👍 |
No description provided.