NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
501 stars 191 forks source link

C++ CLI: Calling a non existing method in a measure ends up with a crash and stack trace #5018

Closed jmarrec closed 11 months ago

jmarrec commented 11 months ago

Issue overview

Current Behavior

For example, if you put in a measure something like:

  def run(model, runner, user_arguments)
    super(model, runner, user_arguments)

    runner.nonExistingMethod()

You end up with a hard crash.

Expected Behavior

It should gracefully fail and report the error.

Steps to Reproduce

See Current behavior

Possible Solution

The issue is that we do ScriptObject->run(args) whereas the ruby CLI was all under a rb_protect block.

We need to find a way to do things like RubyInterpreter::makeProtectedCall or RubyEval's evalString (the Ruby Engine has exec / eval that call evalString).

Details

Environment

Some additional details about your environment for this issue (if relevant):

Context

kbenne commented 11 months ago

@jmarrec check out my proposal. I think we can build on this. https://github.com/NREL/OpenStudio/commit/05e59963ec0a88c556a09c19f90f7c44ab20d663