tilde-lab / metis-client

Metis infrastructure API client in Python
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

MetisError to show the HTTP status code and error message (if any) #8

Closed blokhin closed 1 year ago

blokhin commented 1 year ago

Currently the stack trace is not really helpful:

  File "/home/eb/metis-client/lib/python3.8/site-packages/metis_client/helpers.py",
  line 133, in metis_error_to_raise
    raise err(status=dto["status"], message=msg)
metis_client.exc.MetisError
blokhin commented 1 year ago

To reproduce, change engine in client.v0.calculations.create(data['id'], engine="dummy") to any other string (non-existing engine). Then the backend returns error 400, and the BFF returns error 421, but the client does not provide any clue about that.