-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 4.1.2
-
Fix Version/s: 4.1.4
-
Component/s: Direct Edit
-
Tags:
-
Sprint:nxDrive 11.1.10
-
Story Points:0
Error
Trying DirectEdit on an inexistant document results in a unfriendly stacktrace:
Traceback (most recent call last): File "nuxeo/client.py", line 194, in request resp.raise_for_status() File "requests/models.py", line 939, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: for url: http://SERVER/nuxeo/site/automation/Document.Fetch During handling of the above exception, another exception occurred: Traceback (most recent call last): File "client/remote_client.py", line 121, in execute return self.operations.execute(**kwargs) File "nuxeo/operations.py", line 200, in execute default=kwargs.get('default', object)) File "nuxeo/client.py", line 197, in request raise self._handle_error(exc) nuxeo.exceptions.HTTPError: HTTPError(404), error: Failed to invoke operation: Repository.GetDocument, DOC_UID, server trace: None During handling of the above exception, another exception occurred: Traceback (most recent call last): File "engine/workers.py", line 181, in run self._execute() File "direct_edit.py", line 739, in _execute self.handle_url() File "direct_edit.py", line 158, in handle_url download_url=info["download_url"], File "direct_edit.py", line 480, in edit raise e File "direct_edit.py", line 468, in edit server_url, doc_id, user=user, download_url=download_url File "direct_edit.py", line 364, in _prepare_edit info = self._get_info(engine, doc_id) File "direct_edit.py", line 312, in _get_info doc_id, headers={"fetch-document": "lock"}, enrichers=["permissions"] File "client/remote_client.py", line 487, in fetch return self.execute(command="Document.Fetch", value=get_text(ref), **kwargs) File "client/remote_client.py", line 127, in execute raise NotFound(stack)
Fix
diff --git a/nxdrive/direct_edit.py b/nxdrive/direct_edit.py index 19cc317b..ab345aac 100644 --- a/nxdrive/direct_edit.py +++ b/nxdrive/direct_edit.py @@ -319,6 +319,10 @@ class DirectEdit(Worker): log.warning(msg) self.directEditForbidden.emit(doc_id, engine.hostname, engine.remote_user) return None + except NotFound: + values = [doc_id, engine.hostname] + self.directEditError.emit("DIRECT_EDIT_NOT_FOUND", values) + return None doc.update( {
DIRECT_EDIT_NOT_FOUND would be something like: "„%1“ not found on %2".