Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Errors and Exceptions: Is there a third option? (clace.io)
1 point by ajayvk on Dec 9, 2024 | hide | past | favorite | 4 comments


The "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.


Yes, 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.


This started from a discussion thread at https://news.ycombinator.com/item?id=42368065. Created a new topic since this could apply more generally outside of Starlark


Bugs




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: