Add new exception types for unsupported features and responses#1556
Merged
Conversation
- Introduced BSBLANUnsupportedFeatureError for permanent feature unavailability. - Introduced BSBLANMalformedResponseError for transient JSON parsing issues. - Updated relevant code to raise new exceptions in appropriate scenarios. - Enhanced tests to cover new exception handling.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1556 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 14 14
Lines 1334 1338 +4
Branches 142 143 +1
=========================================
+ Hits 1334 1338 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a clearer exception taxonomy to python-bsblan so callers can distinguish permanent unsupported-feature failures from transient malformed-response failures, while preserving backward compatibility via BSBLANError subclassing.
Changes:
- Introduces
BSBLANUnsupportedFeatureErrorandBSBLANMalformedResponseError(both subclassBSBLANError) and re-exports them at the top-level package. - Reclassifies schedule “no params available” cases as unsupported feature errors, and transport JSON decode/parse failures as malformed response errors.
- Updates documentation/spec artifacts and expands tests to assert the new concrete exception types (and that they remain catchable as
BSBLANError).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/bsblan/exceptions.py |
Adds the two new exception subclasses with documented permanent/transient semantics. |
src/bsblan/__init__.py |
Re-exports the new exceptions and adds them to __all__ for public API access. |
src/bsblan/_schedules.py |
Raises BSBLANUnsupportedFeatureError when heating schedule params can’t be mapped. |
src/bsblan/_hot_water.py |
Raises BSBLANUnsupportedFeatureError only for the hot-water schedule group when params are absent. |
src/bsblan/_transport.py |
Raises BSBLANMalformedResponseError when response JSON decoding/parsing fails. |
tests/test_heating_schedule.py |
Updates schedule “no params” test to assert BSBLANUnsupportedFeatureError (+ still a BSBLANError). |
tests/test_hot_water_additional.py |
Updates hot-water schedule “no params” test to assert BSBLANUnsupportedFeatureError, and ensures state stays generic. |
tests/test_bsblan_edge_cases.py |
Updates malformed-response test to assert BSBLANMalformedResponseError (+ still a BSBLANError). |
docs/api/exceptions.md |
Documents the new exceptions in the public API docs. |
openspec/specs/error-classification/spec.md |
Adds a spec describing the new error-classification requirements and scenarios. |
openspec/changes/archive/2026-07-12-distinguish-schedule-error-types/tasks.md |
Archives the implementation task checklist for this change. |
openspec/changes/archive/2026-07-12-distinguish-schedule-error-types/specs/error-classification/spec.md |
Archives the delta spec content for the change. |
openspec/changes/archive/2026-07-12-distinguish-schedule-error-types/proposal.md |
Archives the proposal rationale and scope for the taxonomy change. |
openspec/changes/archive/2026-07-12-distinguish-schedule-error-types/design.md |
Archives the design decisions and trade-offs behind the taxonomy. |
openspec/changes/archive/2026-07-12-distinguish-schedule-error-types/.openspec.yaml |
Records the archived change metadata. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



This pull request introduces a new exception taxonomy to the library, allowing consumers to distinguish between permanent unsupported-feature errors and transient malformed-response errors. Two new exception classes are added—
BSBLANUnsupportedFeatureErrorfor permanent conditions andBSBLANMalformedResponseErrorfor transient errors—both subclassing the existingBSBLANErrorto preserve backward compatibility. The changes affect schedule read paths, transport error handling, documentation, and tests.Exception taxonomy improvements:
BSBLANUnsupportedFeatureErrorandBSBLANMalformedResponseErroras subclasses ofBSBLANErrorinsrc/bsblan/exceptions.py, with docstrings describing their semantics (permanent vs. transient).src/bsblan/__init__.pyto import and re-export the new exceptions, and included them in__all__for top-level package access. [1] [2]Schedule read path changes (permanent error):
src/bsblan/_schedules.pyandsrc/bsblan/_hot_water.py, replaced bareBSBLANErrorraises withBSBLANUnsupportedFeatureErrorwhen schedule parameters are absent, and updated docstrings accordingly. [1] [2] [3] [4] [5] [6]Transport parse path changes (transient error):
src/bsblan/_transport.py, replaced the generic error raise withBSBLANMalformedResponseErrorfor decode/parse failures, and updated docstrings to document the new exception. [1] [2] [3]Documentation and specification:
docs/api/exceptions.mdand updated the specification and design documentation to reflect the new taxonomy and requirements. [1] [2] [3] [4] [5]Testing and validation:
These changes are fully backward compatible: existing
except BSBLANErrorhandlers will continue to catch all library exceptions, while consumers can now opt into finer-grained error handling by catching the new exception types.