Skip to content

v0.4.3-alpha: Merge pull request #9 from danielfcollier/feat-improve-error-handling

Latest

Choose a tag to compare

@danielfcollier danielfcollier released this 09 Jan 22:52
e67b072

Release Notes: CalibratorTransformer Error Handling Update

🚀 Improvements

  • Graceful Error Handling: Removed hard exits (sys.exit or implicit crashes) from the _parse_frequency_response method.
  • Explicit Exceptions: The class now explicitly raises ValueError (for invalid data/formats) or FileNotFoundError when parsing calibration files fails.
  • Logging Adjustments: Downgraded log levels for parsing failures from CRITICAL to ERROR, reflecting that these are now recoverable exceptions rather than system-terminating events.

⚠️ Breaking Changes

  • Exception Handling Required: Consumer code instantiating CalibratorTransformer should now wrap the initialization in a try/except block to catch ValueError or FileNotFoundError if robust error recovery is desired.

Example Usage

try:
    transformer = CalibratorTransformer(file_path, ...)
except (ValueError, FileNotFoundError) as e:
    logger.error(f"Calibration failed: {e}")
    # Fallback logic here