-
Notifications
You must be signed in to change notification settings - Fork 7
Improve API consistency #57
Copy link
Copy link
Open
Labels
part:❓We need to figure out which part is affectedWe need to figure out which part is affectedpriority:❓We need to figure out how soon this should be addressedWe need to figure out how soon this should be addressedtype:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
Metadata
Metadata
Assignees
Labels
part:❓We need to figure out which part is affectedWe need to figure out which part is affectedpriority:❓We need to figure out how soon this should be addressedWe need to figure out how soon this should be addressedtype:enhancementNew feature or enhancement visitble to usersNew feature or enhancement visitble to users
What's needed?
The
list_microgrid_electrical_componentsmethod returnslist[ElectricalComponent]. When there are errors in the proto conversion, they are raised:frequenz-client-assets-python/src/frequenz/client/assets/_client.py
Lines 118 to 120 in cd345b3
The
list_microgrid_electrical_component_connectionsmethod on the other hand returnslist[ComponentConnection | None]. When there's a protobuf conversion error, we get aNone:frequenz-client-assets-python/src/frequenz/client/assets/_client.py
Lines 145 to 150 in cd345b3
They should have consistent behaviour.
Proposed solution
The idiomatic Python way for handling errors is through exceptions. So
list_microgrid_electrical_component_connectionsshould stop sendingNonevalues and raise exceptions instead.Use cases
No response
Alternatives and workarounds
No response
Additional context
No response