Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #5016
jmarrec opened this issue Nov 9, 2023 · 1 comment · Fixed by #5023
Closed
Tracked by #5016

Comments

@jmarrec
Copy link
Collaborator

jmarrec commented Nov 9, 2023

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):

  • Platform (Operating system, version): all
  • Version of OpenStudio (if using an intermediate build, include SHA): 3.7.0-rc2

Context

@kbenne kbenne self-assigned this Nov 9, 2023
@kbenne kbenne added the labs label Nov 9, 2023
kbenne added a commit that referenced this issue Nov 10, 2023
This shows how to turn errors arising from Swig director calls into
normal C++ exceptions.

ref #5018
@kbenne
Copy link
Contributor

kbenne commented Nov 10, 2023

@jmarrec check out my proposal. I think we can build on this. 05e5996

kbenne added a commit that referenced this issue Nov 10, 2023
Fix #5018 - C++ CLI: Calling a non existing method in a measure ends up with a crash and stack trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants