docs: def catch_raise_api_exception():
      """Context manager that translates upstream API exceptions."""
      try:
          yield
      except _ApiException as exc:
          detail = None
          fields = None
  
          if exc.body:
              try:
                  # pylint: disable=no-member
                  data = json.loads(exc.body)
                  detail = data.get("detail", None)
                  fields = data.get("fields", None)
              except ValueError:
                  pass
  
          detail = detail or exc.reason
  
          raise ApiException(
              exc.status, detail=detail, headers=exc.headers, body=exc.body, fields=fields
          )