This may be a basic question but I am having a bit of trouble finding an answer in the forums / wiki / Harlowe page
Some commands in twine might generate an error - such as trying to get a value from a datamap when the value doesn't exist. If you'd like to do your own error handling for some reason, how would you go about catching and hiding the error (and getting some value of the error so you can do something based on why the error came up, or re-throw it later)
In other words, I'm curious how I'd do something like this (with this currently not working of-course)
(set: $x to (datamap: "syn", "good"))
(print: $x's "syn")
(set: $x to (datamap: "nosyn", "bad"))
(catch: (print: $x's "syn") to $_error)
(if: $_error is "synNotFound" )[ (print: "defaultValue") ]
(elseif: $_error is not empty)[ Unexpected error: $_error ]
Any thoughts?
Comments
(its not a terribly huge deal, I can make hacky workaround as needed, but clean code would be nicer