@@ -1673,31 +1673,34 @@ async def handle_err_response(resp: PullErrorResponse) -> None:
1673
1673
async for resp in docker .images .pull (
1674
1674
image_ref .canonical , auth = auth_config , stream = True
1675
1675
):
1676
- match resp :
1677
- case dict () if resp .get ("status" ):
1678
- _resp = PullResponse (status = resp ["status" ])
1679
- if detail := resp .get ("progressDetail" ):
1680
- _resp ["progressDetail" ] = detail
1681
- if progress := resp .get ("progress" ):
1682
- _resp ["progress" ] = progress
1683
- if id := resp .get ("id" ):
1684
- _resp ["id" ] = id
1685
- if do_report_per_layer :
1686
- await handle_response_for_each_layer (_resp , layer_to_reporter_id_map )
1687
- else :
1688
- await handle_response (_resp , layer_ids )
1689
- case dict () if resp .get ("error" ):
1690
- err_msg = str (resp ["error" ])
1691
- await handle_err_response (
1692
- PullErrorResponse (
1693
- error = resp ["error" ],
1694
- errorDetail = resp ["errorDetail" ],
1676
+ try :
1677
+ match resp :
1678
+ case dict () if resp .get ("status" ):
1679
+ _resp = PullResponse (status = resp ["status" ])
1680
+ if detail := resp .get ("progressDetail" ):
1681
+ _resp ["progressDetail" ] = detail
1682
+ if progress := resp .get ("progress" ):
1683
+ _resp ["progress" ] = progress
1684
+ if id := resp .get ("id" ):
1685
+ _resp ["id" ] = id
1686
+ if do_report_per_layer :
1687
+ await handle_response_for_each_layer (
1688
+ _resp , layer_to_reporter_id_map
1689
+ )
1690
+ else :
1691
+ await handle_response (_resp , layer_ids )
1692
+ case dict () if resp .get ("error" ):
1693
+ err_msg = str (resp ["error" ])
1694
+ await handle_err_response (
1695
+ PullErrorResponse (
1696
+ error = resp ["error" ],
1697
+ errorDetail = resp ["errorDetail" ],
1698
+ )
1695
1699
)
1696
- )
1697
- case _:
1698
- log .warning (
1699
- f"Unable to deserialize pulling response. skip. (resp:{ str (resp )} )"
1700
- )
1700
+ case _:
1701
+ raise KeyError
1702
+ except KeyError :
1703
+ log .warning (f"Unable to deserialize pulling response. skip. (resp:{ str (resp )} )" )
1701
1704
return err_msg
1702
1705
1703
1706
async def check_image (
0 commit comments