miniscript icon indicating copy to clipboard operation
miniscript copied to clipboard

feature request: error handler

Open symful opened this issue 1 year ago • 2 comments

ret = try(@callback)
{
  isError: ValBool,
  isValue: ValBool,
  value: Value,
  error: Value
}

Will be great to have this as I am unable to make it by my own without messing the code in the main repository.

symful avatar Sep 25 '24 12:09 symful

This is an interesting idea. Currently being discussed in the Discord server — feel free to jump in!

JoeStrout avatar Sep 25 '24 15:09 JoeStrout

What specific sort of error do you want to trap with this? You can make this yourself, for any function you write, provided it does not contain MiniScript runtime errors. But runtime errors almost always indicate a bug in your code; you should fix the bug, rather than trap the result and do something about it.

So, what's the use case where you need some extra language support?

JoeStrout avatar Sep 25 '24 16:09 JoeStrout