When using the `BasicScriptingHost.eval(...)` func...
# scripting
o
When using the
BasicScriptingHost.eval(...)
function to run script code, is there any way, a script can programmatically add elements to the
reports
property of the
ResultWithDiagnostics
that it returns? In some situations that are caught at runtime of my script, I want to return a warning just like a compiler warning, but my script can only detect this at runtime like when a user does something they are not intended to do. My current "solution" is to log a warning using a logger... but this is really not what I want. I need this information as a side-information along with the result of the script evaluation. So, ideally, in my script, I would like to call a function that adds elements to this collection of
ScriptDiagnostic
elements with a severity of warning... Is that possible?
i
There is no such feature (yet). Maybe it makes sense to create a YT issue, so we can consider it. If you'd like to implement it yourself, you need a custom scripting host, namely the evaluator, and you'll need to expose some way to report errors via the evaluation configuration.
o
Sounds doable, let's see whether I find the time... 🙈