Skip to content

[FSSDK-12497] Fix return in finally block silently swallowing exceptions#505

Open
FarhanAnjum-opti wants to merge 1 commit intomasterfrom
farhan/FSSDK-12497-fix-finally-return-swallowing-exceptions
Open

[FSSDK-12497] Fix return in finally block silently swallowing exceptions#505
FarhanAnjum-opti wants to merge 1 commit intomasterfrom
farhan/FSSDK-12497-fix-finally-return-swallowing-exceptions

Conversation

@FarhanAnjum-opti
Copy link
Copy Markdown
Contributor

@FarhanAnjum-opti FarhanAnjum-opti commented Apr 16, 2026

Summary

Fixes a bug where a return statement inside a finally block in _set_config silently swallows exceptions. Per Python docs, a return in finally suppresses any in-flight exception, meaning errors raised inside except blocks are completely lost with no traceback.

Changes

  • Moved error-handling logic out of finally into normal control flow after the try/except block
  • Changed bare except: to except Exception: to avoid catching KeyboardInterrupt and SystemExit
  • Added unit test verifying that exceptions in the except block propagate correctly

Jira Ticket

FSSDK-12497

Issues

Move error-handling logic out of finally block into normal control flow
and change bare except to except Exception. Per Python docs, a return
in finally suppresses any in-flight exception, which silently swallows
errors raised inside except blocks.

Fixes #439

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@Mat001 Mat001 left a comment

Choose a reason for hiding this comment

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

yeah, looks good

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.

return in finally can swallow exception

2 participants