comparison sat/plugins/plugin_comp_ap_gateway/__init__.py @ 4014:4ef473116499

component AP gateway (http): handle properly NotFound error: When an `exceptions.NotFound` is received, log a warning message and return the appropriate HTTP code instead of raising the default `exceptions.InternalError`.
author Goffi <goffi@goffi.org>
date Sat, 18 Mar 2023 16:53:21 +0100
parents b13673d998dc
children 4a2c261646b6
comparison
equal deleted inserted replaced
4013:b13673d998dc 4014:4ef473116499
472 self.client, author_jid, node, item_ids=[item_id] 472 self.client, author_jid, node, item_ids=[item_id]
473 ) 473 )
474 try: 474 try:
475 found_item = found_items[0] 475 found_item = found_items[0]
476 except IndexError: 476 except IndexError:
477 raise exceptions.NotFound("requested items can't be found") 477 raise exceptions.NotFound(f"requested item at {url} can't be found")
478 478
479 if node.startswith(self._events.namespace): 479 if node.startswith(self._events.namespace):
480 # this is an event 480 # this is an event
481 event_data = self._events.event_elt_2_event_data(found_item) 481 event_data = self._events.event_elt_2_event_data(found_item)
482 ap_item = await self.ap_events.event_data_2_ap_item( 482 ap_item = await self.ap_events.event_data_2_ap_item(