Skip to content

Fix garbled error message for invalid importance sampling method#332

Closed
ishaan-arora-1 wants to merge 1 commit intostan-dev:masterfrom
ishaan-arora-1:fix/invalid-is-method-error-message
Closed

Fix garbled error message for invalid importance sampling method#332
ishaan-arora-1 wants to merge 1 commit intostan-dev:masterfrom
ishaan-arora-1:fix/invalid-is-method-error-message

Conversation

@ishaan-arora-1
Copy link
Contributor

Fixes #331

assert_importance_sampling_method_is_implemented() was referencing the function object implemented_is_methods rather than calling it with (). This meant the error message for an invalid IS method would print the function body instead of the actual method names.

Before

Importance sampling method 'foo' is not implemented. Implemented methods: 'function () 
c("psis", "tis", "sis")'

After

Importance sampling method 'foo' is not implemented. Implemented methods: 'psis', 'tis', 'sis'

Added a test to verify the error message lists the valid methods.

assert_importance_sampling_method_is_implemented() was passing the function
object implemented_is_methods to paste0() instead of calling it with ().
This caused the error message to print the function body rather than listing
the valid methods.

Also add a test to verify the error message content.
@jgabry
Copy link
Member

jgabry commented Feb 27, 2026

Wasn't this already part of your PR #326 that was merged?

@ishaan-arora-1
Copy link
Contributor Author

ishaan-arora-1 commented Feb 27, 2026

Wasn't this already part of your PR #326 that was merged?

oh yeah right, i was wondering the same thing. i could soo remember solving this, my bad, version differences.
Thankyouu!

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.98%. Comparing base (2883f25) to head (617665d).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #332      +/-   ##
==========================================
+ Coverage   92.78%   92.98%   +0.20%     
==========================================
  Files          31       31              
  Lines        2992     2992              
==========================================
+ Hits         2776     2782       +6     
+ Misses        216      210       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jgabry
Copy link
Member

jgabry commented Feb 27, 2026

No problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error message for invalid IS method prints function body instead of method names

3 participants