Skip to content

#1670: wrap incremate require/__send__ in rescue to prevent crash#1766

Closed
VasilevNStas wants to merge 2 commits into
zerocracy:masterfrom
VasilevNStas:1670-incremate-rescue
Closed

#1670: wrap incremate require/__send__ in rescue to prevent crash#1766
VasilevNStas wants to merge 2 commits into
zerocracy:masterfrom
VasilevNStas:1670-incremate-rescue

Conversation

@VasilevNStas

@VasilevNStas VasilevNStas commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #1670

Wrap require and __send__ in Jp.incremate with a begin/rescue StandardError to prevent crashes when a sub-judge file fails to load or execute. The error is logged and the loop continues to the next sub-judge via next.

This handles cases where:

  • A sub-judge Ruby file has syntax errors
  • A sub-judge method raises an unhandled exception
  • A sub-judge file is missing or corrupted

@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 plz review

Comment thread lib/incremate.rb Outdated
throw(:"Collected #{n}: [#{h.map { |k, v| "#{k}: #{v}" }.join(', ')}]")
end
throw(:"Collected #{n}: [#{h.map { |k, v| "#{k}: #{v}" }.join(', ')}]")
rescue StandardError => e

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VasilevNStas remove this

@VasilevNStas VasilevNStas force-pushed the 1670-incremate-rescue branch from 23214bb to 28729d6 Compare July 13, 2026 20:27
@VasilevNStas

Copy link
Copy Markdown
Contributor Author

@yegor256 You are right. Removed the rescue StandardError block — fail fast. If a sub-judge crashes, the exception propagates.

@0crat

0crat commented Jul 14, 2026

Copy link
Copy Markdown

@yegor256 Thanks for the review! You've earned +9 points for this: +18 as a basis; -5 for very few (1) comments; -4 for too few (0) hits-of-code. Your running score is +702; don't forget to check your Zerocracy account too).

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.

lib/incremate.rb has no rescue around __send__ or require_relative

3 participants