4 ms·
Errors and Exceptions: Is there a third option?
- ajayvk 2y agoThis started from a discussion thread at https://news.ycombinator.com/item?id=42368065 https://news.ycombinator.com/item?id=42368065. Created a new topic since this could apply more generally outside of Starlark
- AnimalMuppet 2y agoThe "normal" third option is Maybe or Option types. (Though if you squint, that can look like returning an error with an unusual encoding.) The solution proposed here looks like setting a thread property on error, and if you don't clear it, then subsequent function calls fail (if I read that right). Personally, I don't love it. I prefer my error handling to be open rather than hidden.
- ajayvk 2y agoYes, Option type is a special value type. The solution here is more oriented towards glue code, code which strings together multiple API calls. The attempt is to provide a set -e type error handling for such code. What I have seen is that some error handling, even if it not perfect, is better than letting errors be ignored.
- RGamma 2y agoBugs