fix: replace 8 bare except:pass clauses with specific exception handling (fixes #115)#135
Open
charlesaurav13 wants to merge 1 commit into
Open
Conversation
Fixes BusKill#115. Eight bare except: pass clauses were silently swallowing all exceptions including KeyboardInterrupt and SystemExit, making debugging nearly impossible and preventing clean shutdown via Ctrl+C. Changes: - Cleanup path (usb_handler.join, upgrade_process.join, wipeCache): catch Exception and log at DEBUG level so failures are visible - toggle() disarm path: same pattern for usb_handler kill/join - wipeCache() umount and makedirs: log at DEBUG level - KEYS file fallback: narrow to FileNotFoundError since only a missing file should trigger the fallback; other errors should propagate Signed-off-by: charlesaurav13 <sauravp1236@gmail.com>
|
INFO: No unicode characters found in PR's commits (source) |
Member
|
Thanks for the PR :) Please note that this repo does not accept contributions that use AI Can you please tell us if you wrote this code, comments, and PR contents entirely by yourself? Or if you used AI for any part of it? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Eight bare
except: passclauses inbuskill/__init__.pywere silently swallowing all exceptions, includingKeyboardInterruptandSystemExit. This made debugging nearly impossible and prevented clean shutdown via Ctrl+C.Changes
__del__—usb_handler.join()except: passexcept Exception as e: logger.debug(...)__del__—upgrade_process.join()except: passexcept Exception as e: logger.debug(...)__del__—wipeCache()except: passexcept Exception as e: logger.debug(...)setupDataDir— DATA_DIR logexcept:except Exception as e:toggle()disarm —usb_handlerkill/joinexcept: passexcept Exception as e: logger.debug(...)wipeCache()—umountexcept: passexcept Exception as e: logger.debug(...)wipeCache()—makedirs/chmodexcept: passexcept Exception as e: logger.debug(...)doUpgrade— KEYS file fallbackexcept:except FileNotFoundError:(narrowed to the one expected failure mode)All cleanup-path exceptions are now logged at DEBUG level instead of being silently dropped.
KeyboardInterruptandSystemExitare no longer swallowed.Test plan
Closes #115