Skip to content

fix: Print more details on errors

Wiktor Kwapisiewicz requested to merge wiktor/handle-response-errors into main

This PR changes two things:

  1. It uses a newer version of nethsm_sdk_rs which fixes the "serde error" issue reported upstream: #30.

Previously the error message would indicate serde error:

Error: NetHsm(Api("Getting backup failed: error in serde: EOF while parsing a value at line 1 column 0"))

Now, they print the status code instead:

Error: NetHsm(Api("Getting backup failed: Status code: 401: "))
  1. It explicitly handles the response error and prints the content that the NetHSM API returns, in case it is available:

Instead of:

Error: NetHsm(Api("Getting key failed: in response: status code 412"))

it prints:

Error: NetHsm(Api("Getting key failed: Status code: 412: Service not
available"))

(Service not available is the error message returned by the NetHSM API)

Additionally, this MR fixes documentation strings using new additions in the nethsm SDK.

Fixes: #29 (closed)

Edited by Wiktor Kwapisiewicz

Merge request reports

Loading