From 8f4de7adbfe39eaba27c20d84aac60490be81204 Mon Sep 17 00:00:00 2001 From: Swann Date: Fri, 13 Nov 2020 14:15:11 +0100 Subject: [PATCH] feat(replication): handle error outside the data protocol refactor(replication): remove background worker --- multi_user/__init__.py | 2 +- multi_user/operators.py | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/multi_user/__init__.py b/multi_user/__init__.py index 389d4c8..8302c8f 100644 --- a/multi_user/__init__.py +++ b/multi_user/__init__.py @@ -44,7 +44,7 @@ from . import environment DEPENDENCIES = { - ("replication", '0.1.9'), + ("replication", '0.1.10'), } diff --git a/multi_user/operators.py b/multi_user/operators.py index dc8611c..a9eb4b4 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -576,9 +576,13 @@ class SessionApply(bpy.types.Operator): def execute(self, context): logging.debug(f"Running apply on {self.target}") - session.apply(self.target, - force=True, - force_dependencies=self.reset_dependencies) + try: + session.apply(self.target, + force=True, + force_dependencies=self.reset_dependencies) + except Exception as e: + self.report({'ERROR'}, repr(e)) + return {"CANCELED"} return {"FINISHED"} @@ -596,11 +600,13 @@ class SessionCommit(bpy.types.Operator): return True def execute(self, context): - # session.get(uuid=target).diff() - session.commit(uuid=self.target) - session.push(self.target) - return {"FINISHED"} - + try: + session.commit(uuid=self.target) + session.push(self.target) + return {"FINISHED"} + except Exception as e: + self.report({'ERROR'}, repr(e)) + return {"CANCELED"} class ApplyArmatureOperator(bpy.types.Operator): """Operator which runs its self from a timer"""