Skip to content

fix: replace bare except clauses with specific exception types #1173

Description

@rtmalikian

Problem

Bare except: clauses catch KeyboardInterrupt, SystemExit, and GeneratorExit in addition to intended exceptions. This prevents graceful shutdown and makes debugging harder.

Affected Files

  • pyhealth/metrics/ranking.py: except: should be except ImportError:
  • pyhealth/calib/predictionset/scrib/quicksearch.py: except: should be except ImportError:
  • pyhealth/datasets/base_dataset.py: two except: on queue.get(timeout=1) should catch queue.Empty

Proposed Fix

Replace each bare except: with the specific exception type it's intended to handle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions