logoalt Hacker News

jcmfernandes12/09/20242 repliesview on HN

This is also one of my major complaints at this point. I'm building a developer tool with starklark resting at its core and I had already came across your work.

I wish the starklark team had addressed it at this point.


Replies

mahmoudimus12/09/2024

We solved this by introducing a Result library.

  load("@.../result", result=result)

  
  def throw(arg):
      return 1/0
  if result.Result(throw).map(arg).is_ok:
     # proceed
  else:
     fail("...")
ajayvk12/09/2024

I wrote up the approach I used at https://clace.io/blog/errors/, started a discussion at https://news.ycombinator.com/item?id=42370488 since it could apply outside of Starlark also