Skip to content

Conversation

@zealot-zew
Copy link
Contributor

@zealot-zew zealot-zew commented Dec 2, 2025

This PR addresses a logical inconsistency in js/blocks/PitchBlocks.js within the SetPitchNumberOffsetBlock. Previously, the block would throw a UI error message when inputs were missing (null) but would continue to execute using hardcoded defaults ("C" and 4).

Changes:

Modified the flow method in SetPitchNumberOffsetBlock.
Added a return statement immediately after the error check to halt execution when inputs are invalid.
Removed the fallback logic for default values (const arg0 = ... ? "C" : ...), as it is now unreachable and unnecessary.

Impact:

Ensures the application fails gracefully and truthfully: when an error message is shown, the action is actually cancelled.
Prevents "silent failures" where a user thinks their code is working but it is actually running on hidden default values.

Fixes #4818

added a missing zero-division check to doMod in js/utils/mathutils.js.
doDivide() already throws a DivByZeroError, but doMod() returned NaN when b = 0, causing inconsistent behavior.

This PR addresses a logical inconsistency in js/blocks/PitchBlocks.js within the SetPitchNumberOffsetBlock. Previously, the block would throw a UI error message when inputs were missing (null) but would continue to execute using hardcoded defaults ("C" and 4).
@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 2, 2025

✅ All Jest tests passed! This PR is ready to merge.

@walterbender
Copy link
Member

@pikurasa what do you think?

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.

Conflicting error handling in SetPitchNumberOffsetBlock flow

2 participants