Repository navigation
Remove _with_issue() proto conversion and make errors more explicit #239
Copy link
Copy link
Open
Copy link
Labels
type:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
Milestone
Description
Activity
- addedtype:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
on Jul 6, 2026 - linked a pull request that will close this issueMake `Microgrid`/`ElectricalComponent` `.name` non-optional #238
on Jul 9, 2026 - removed a link to a pull requestMake `Microgrid`/`ElectricalComponent` `.name` non-optional #238
on Jul 9, 2026 - linked a pull request that will close this issueMake `Microgrid`/`ElectricalComponent` `.name` non-optional #238
on Jul 9, 2026 - added 4 commits that reference this issue
on Jul 13, 2026 - linked a pull request that will close this issueRemove/deprecate remainain instances of `_with_issues` functions #272
on Aug 21, 2026 Partially addressed for v0.4.1:
- Make
Microgrid/ElectricalComponent.namenon-optional #238 (dropped the name is empty minor issue) - Remove/deprecate remainain instances of
_with_issuesfunctions #272 (deprecated/removed the remaining_from_proto_with_issues()flavours in favour of validity encoded in the return type).
The actual removal of the deprecated
_with_issuesfunctions remains for v0.5.0.- Make
Status update: every remaining
_with_issues()function is deprecated in v0.4.1 with a type-level replacement (*_from_proto2()returningX | InvalidX, ormetric_sample_from_proto()/metric_connection_from_proto()), see #272. What's left for this issue is only the removal of the deprecated functions, tracked by the v0.5.0 milestone.- added a commit that references this issue
on Sep 16, 2026
Metadata
Metadata
Assignees
Labels
type:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
Type
Fields
Priority
None yet
Effort
Medium
What's needed?
The family of functions
xxx_from_proto_with_issues()are very precarious. Errors are just arbitrary strings, making it very hard to act on, and very fragile (a change in the message could mean breakage).We need a better way to validate and report errors.
Proposed solution
We should move forward with the approach to report issues via special representation (like
ProblematicElectricalComponent) or make errors fails more loudly for safe access, like the enum accessors that raise onUNSPECIFIEDor unrecognized values.At the end the goal is to remove
_with_issues()conversion function flavors and ideally return a representation of an invalid object on failures, so users can still inspect the invalid data in case they want to apply some custom error recovery. Sometimes it might be fine to simply raise an error in the conversion function, but that should be a last resort measure.Additional context
As a second stage, alternative ways to deal with errors could be provided, but probably as separate functions. For example we could add a
validate()function or method, that checks all the data in an instance is valid. It could raise on the first error or collect errors, or log them, we can make error reporting pluggable.