Add wordy - #495
Add wordy#495
Conversation
bdc4fdb to
6e55c04
Compare
|
|
||
| ## Zig-specific instructions | ||
|
|
||
| If an error occurs, return `null`. |
There was a problem hiding this comment.
Why not return an exception that (hopefully) provides a directive message on how to avoid raising that exception instead? This is a practice exercise, and as a library should not swallow exceptions.
6e55c04 to
0e5a63c
Compare
| } | ||
|
|
||
| test "Non math question" { | ||
| try testing.expectError(ArgumentError.UnknownOperation, answer("Who is the President of the United States?")); |
There was a problem hiding this comment.
Why is this unknown operation instead of something like improper question? (Naming is hard, unsure what to name the error, but this seems "wrong" as the operation may be wrong, but the operands also seem wrong, but really because it is the wrong kind of question.)
There was a problem hiding this comment.
The canonical data has "unknown operation" and "syntax error". I added division by zero as a third error type.
I have now renamed UnknownOperation to UnsupportedQuestion, so it fits both
- Unsupported operations ("What is 52 cubed?")
- Non-math questions ("Who is the President of the United States")
No description provided.