Uploaded image for project: 'Nuxeo Python Client'
  1. Nuxeo Python Client
  2. NXPY-118

Missing status code from Forbidden and Unauthorized exceptions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.2.2
    • Component/s: None
    • Story Points:
      0

      Description

      This is not directly an error from the client, but crafting such exception from outside (like we do it in Drive for tests) will raise:

      139623868233472 workers        E Thread EXCEPTION
      Traceback (most recent call last):
        File "nxdrive/engine/watcher/remote_watcher.py", line 608, in _handle_changes
          self._update_remote_states()
        File "nxdrive/engine/activity.py", line 209, in func_wrapper
          func(*args, **kwargs)
        File "nxdrive/engine/watcher/remote_watcher.py", line 693, in _update_remote_states
          summary = self._get_changes()
        File "nxdrive/engine/watcher/remote_watcher.py", line 644, in _get_changes
          self._last_root_definitions, self._last_event_log_id
        File "nxdrive/client/remote_client.py", line 694, in get_changes
          lastSyncActiveRootDefinitions=last_root_definitions,
        File "tests/old_functional/__init__.py", line 323, in execute
          self._raise(self._server_error, *args, **kwargs)
        File "tests/old_functional/__init__.py", line 343, in _raise
          raise exc
      nuxeo.exceptions.Unauthorized: <unprintable Unauthorized object>
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "nxdrive/engine/workers.py", line 181, in run
          self._execute()
        File "nxdrive/engine/watcher/remote_watcher.py", line 72, in _execute
          if handle_changes(first_pass):
        File "nxdrive/engine/watcher/remote_watcher.py", line 619, in _handle_changes
          log.warning(f"Network error: {exc}")
        File "nuxeo/exceptions.py", line 72, in __str__
          return repr(self)
        File "nuxeo/exceptions.py", line 67, in __repr__
          self.stacktrace,
      TypeError: %d format: a number is required, not NoneType
      

      The fix is simple: we need to set the status code for each exception.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 30 minutes
                  30m