RX0061

Domain: Execution

Error message

match on %s (%s): no arm admitted it and there is no else

In the message, %s marks a value that the engine fills in when it raises the error.

The story

Your match looked at a value, tried every arm, and none of them fit. And you did not write an else. Let me explain how match works. It is a dispatcher: it takes a subject and routes it to the arm whose condition is satisfied. If no arm is satisfied, there is nowhere to route, and no value to hand back up to the rest of the program. The catch-all is yours to write. It is called else. If you leave it out, the engine could simply fall through and keep running, but then the rest of your program would run on a premise you never wrote. Maybe you assumed the subject could only be one of three values, and then a fourth showed up. This refusal catches exactly that surprise. The message shows the subject, both as the heap holds it, and as you wrote it, so you can see what slipped through. The fix: add an else arm, even one that just says what went wrong, or add the arm for the missing case. Cover the whole space.

Text from the Rush engine's error catalogue.