Skip to content

Commit 4df3ee2

Browse files
Fix list gridpool orders (#37)
Log the error if a grid pool order detail cannot be converted from the protobuf message to the OrderDetail object. But continue processing the other order details.
2 parents 0f33776 + 43330a9 commit 4df3ee2

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
# Frequenz Electricity Trading API Client Release Notes
22

3-
## Summary
4-
5-
<!-- Here goes a general summary of what this release is about -->
6-
7-
## Upgrading
8-
9-
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10-
11-
## New Features
12-
13-
<!-- Here goes the main new features and examples or instructions on how to use them -->
14-
153
## Bug Fixes
164

17-
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->
5+
- Fixed list gridpool orders to log an error when an order conversion from protobuf failed and continuing to process other orders.

src/frequenz/client/electricity_trading/_client.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,10 +639,17 @@ async def list_gridpool_orders( # pylint: disable=too-many-arguments
639639
),
640640
)
641641

642-
return [
643-
OrderDetail.from_pb(order_detail)
644-
for order_detail in response.order_details
645-
]
642+
orders: list[OrderDetail] = []
643+
for order_detail in response.order_details:
644+
try:
645+
orders.append(OrderDetail.from_pb(order_detail))
646+
except InvalidOperation:
647+
_logger.error(
648+
"Failed to convert order details for order: %s",
649+
str(order_detail).replace("\n", ""),
650+
)
651+
652+
return orders
646653
except grpc.RpcError as e:
647654
_logger.exception("Error occurred while listing gridpool orders: %s", e)
648655
raise e

0 commit comments

Comments
 (0)