JoeStrout / miniscript

source code of both C# and C++ implementations of the MiniScript scripting language
MIT License
277 stars 64 forks source link

feature request: error handler #187

Open symful opened 5 days ago

symful commented 5 days ago
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.

JoeStrout commented 5 days ago

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

JoeStrout commented 5 days ago

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?