The say exercise tests for out-of-range inputs, expecting an IllegalArgumentException. I’ve added code that throws those exceptions (at least, they show up in my REPL). But the Exercism test runner fails my code:
CODE RUN (is (thrown? IllegalArgumentException (say/number -1)))
TEST ERROR An unexpected error occurred: java.lang.Exception: IllegalArgumentException
I don’t see any hints for this exercise, and I could use one (or more) for throwing exceptions that will meet the test.
This might be the hint you are looking for. If this is a practice exercise, then I am not surprised that there is no hint. Searching documentation to answer such questions is a skill that is probably assumed for those practicing the language.
If this is a concept exercise, then it might be expected that this very question is answered in the form of a prior exercise, or the documentation for this one if exceptions are the focused concept, or even only a required concept among others for this concept exercise.
I do not do much in the way of Clojure, but I hope that is helpful.
Thank you, kotp. I did figure that out and code it.
If I’m reading the test results correctly, it’s saying that I have thrown the IllegalArgumentException, but it is still giving me a fail. There may be a nuance that I’m missing.
And because you were throwing a generic Exception, this made the tests themselves throw an Exception telling you that this is an illegal argument instead of just passing without errors :)