Commit 2c780cf8 authored by Morten Brekkevold's avatar Morten Brekkevold
Browse files

Improve ClientError handling

Because:
- We don't need a huge traceback when the API explicitly tells us we made a
  client error (400 Bad request), as the body will include an actual error message
  we can use.
parent b87d22a0
......@@ -507,17 +507,21 @@ def insert_one_into_nav(nav_api, kind_device):
nav_api.post_room(room)
except ClientError as error:
LOG.error(
"Room post feilet for %s. Feilrespons: %s", kind_device.room, error
"Room post feilet for %s. Feilrespons: %s",
kind_device.room,
error.response.body,
)
raise
return
try:
nav_api.post_netbox(netbox)
except ClientError as error:
LOG.error(
"Netbox post feilet for %s. Feilrespons: %s", netbox.get("sysname"), error
"Netbox post feilet for %s. Feilrespons: %s",
netbox.get("sysname"),
error.response.body,
)
raise
return
@functools.lru_cache(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment