From f593ef4a3e64f571a09dc8639069e24af0f69659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 15 Mar 2022 17:49:06 +0100 Subject: [PATCH] Addon: nicer error message when the Manager cannot be reached --- addon/flamenco/operators.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 1440ec1d..d2ca267e 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -4,12 +4,12 @@ import logging from pathlib import Path from typing import Optional, TYPE_CHECKING - -from flamenco.job_types_propgroup import JobTypePropertyGroup +from urllib3.exceptions import HTTPError, MaxRetryError import bpy from . import job_types, job_submission +from .job_types_propgroup import JobTypePropertyGroup if TYPE_CHECKING: from .bat_interface import ( @@ -59,6 +59,11 @@ class FLAMENCO_OT_fetch_job_types(FlamencoOpMixin, bpy.types.Operator): except ApiException as ex: self.report({"ERROR"}, "Error getting job types: %s" % ex) return {"CANCELLED"} + except MaxRetryError as ex: + # This is the common error, when for example the port number is + # incorrect and nothing is listening. + self.report({"ERROR"}, "Unable to reach Manager") + return {"CANCELLED"} if old_job_type_name: # TODO: handle cases where the old job type no longer exists. @@ -80,7 +85,6 @@ class FLAMENCO_OT_ping_manager(FlamencoOpMixin, bpy.types.Operator): from flamenco.manager import ApiException from flamenco.manager.apis import MetaApi from flamenco.manager.models import FlamencoVersion - from urllib3.exceptions import HTTPError, MaxRetryError context.window_manager.flamenco_status_ping = "..."