@@ -52,9 +52,15 @@ class ProgressKind(Enum):
5252
5353class ErrorKind (Enum ):
5454 none = 0
55- plugin_error = 1
56- server_error = 2
57- insufficient_funds = 3
55+ plugin_error = 100
56+ server_error = 200
57+ insufficient_funds = 201
58+ warning = 300
59+ incompatible_lora = 301
60+
61+ @property
62+ def is_warning (self ):
63+ return self .value >= ErrorKind .warning .value
5864
5965
6066class Error (NamedTuple ):
@@ -65,6 +71,11 @@ class Error(NamedTuple):
6571 def __bool__ (self ):
6672 return self .kind is not ErrorKind .none
6773
74+ @staticmethod
75+ def from_string (s : str , fallback : ErrorKind | None = None ):
76+ kind = ErrorKind [s ] if s in ErrorKind .__members__ else fallback or ErrorKind .warning
77+ return Error (kind , s )
78+
6879
6980no_error = Error (ErrorKind .none , "" )
7081
@@ -463,7 +474,7 @@ def cancel(self, active=False, queued=False):
463474
464475 def report_error (self , error : Error | str ):
465476 if isinstance (error , str ):
466- error = Error ( ErrorKind .server_error , error )
477+ error = Error . from_string ( error , ErrorKind .server_error )
467478 self .error = error
468479 self .live .is_active = False
469480 self .custom .is_live = False
@@ -493,6 +504,8 @@ def handle_message(self, message: ClientMessage):
493504 elif message .event is ClientEvent .output :
494505 self .custom .show_output (message .result )
495506 elif message .event is ClientEvent .finished :
507+ if message .error : # successful jobs may have encountered some warnings
508+ self .report_error (Error .from_string (message .error , ErrorKind .warning ))
496509 if message .images :
497510 self .jobs .set_results (job , message .images )
498511 if job .kind is JobKind .control_layer :
0 commit comments