sdk-codegen icon indicating copy to clipboard operation
sdk-codegen copied to clipboard

`move_look` function error not handled

Open larrybirb opened this issue 1 year ago • 1 comments

‎APIMethods._return‎ is not handling errors from ‎Looker40SDK.move_look function. We see a non-useful exception str() failed when the API fails which obscures debugging.

Traceback (most recent call last):
  File "/home/user/shared-tableau-scripts/gcp-perms/looker_api_move_look_production.py", line 23, in <module>
    response = sdk.move_look(id, folder)
  File "/home/user/.local/lib/python3.10/site-packages/looker_sdk/sdk/api40/methods.py", line 7417, in move_look
    self.patch(
  File "/home/user/.local/lib/python3.10/site-packages/looker_sdk/rtl/api_methods.py", line 210, in patch
    return self._return(response, structure)
  File "/home/user/.local/lib/python3.10/site-packages/looker_sdk/rtl/api_methods.py", line 102, in _return
    raise sdk_error
looker_sdk.error.SDKError: <exception str() failed>

The actual API error:

{"message":"Validation Failed","errors":[{"field":"folder_id","code":"already_exists","message":"folder_id and the folder id of the existing look must be different","documentation_url":"
https://cloud.google.com/looker/docs/r/err/4.0/422/patch/looks/:look_id/move"}],"documentation_url":"https://cloud.google.com/looker/docs/r/err/4.0/422/patch/looks/:look_id/move"}

larrybirb avatar Jun 27 '24 03:06 larrybirb