Skip to content

Commit 5694df3

Browse files
committed
improves error messages when loading a background profile
1 parent 3ceac27 commit 5694df3

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/artisanlib/main.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10883,8 +10883,8 @@ def eventaction_internal(self, action:int, cmd:str, eventtype:int|None) -> None:
1088310883
fp = str(eval(c[len('loadBackground('):-1][:eval_limit])) # pylint: disable=eval-used
1088410884
except Exception: # pylint: disable=broad-except
1088510885
fp = str(cs[len('loadBackground('):-1])
10886-
self.loadBackgroundSignal.emit(fp, True)
1088710886
self.sendmessage(f'Artisan Command: {c}')
10887+
self.loadBackgroundSignal.emit(fp, True)
1088810888
except Exception as e: # pylint: disable=broad-except
1088910889
_log.exception(e)
1089010890
# clearBackground
@@ -14574,11 +14574,21 @@ def loadbackground(self, filename:str, quiet:bool = True) -> None: # pyright: ig
1457414574
self.qmc.adderror((QApplication.translate('Error Message', 'IO Error:') + ' loadbackground() {0}').format(str(e)),getattr(exc_tb, 'tb_lineno', '?'))
1457514575
return
1457614576

14577-
except (ValidationError, InvalidSignature, InvalidProfileHash) as e:
14577+
except (ValidationError) as e:
1457814578
# pydantic validation against ProfileData TypedDict failed
1457914579
self.sendmessage(f"{QApplication.translate('Message','Invalid artisan format')}: {filename}")
1458014580
_log.error(e)
1458114581

14582+
except (InvalidSignature) as e:
14583+
# pydantic validation against ProfileData TypedDict failed
14584+
self.sendmessage(f"{QApplication.translate('Message','Not a genuine artisan profile')}: {filename}")
14585+
_log.error(e)
14586+
14587+
except (InvalidProfileHash) as e:
14588+
# pydantic validation against ProfileData TypedDict failed
14589+
self.sendmessage(f"{QApplication.translate('Message','Modified artisan profile')}: {filename}")
14590+
_log.error(e)
14591+
1458214592
except ValueError as e:
1458314593
_, _, exc_tb = sys.exc_info()
1458414594
self.qmc.adderror((QApplication.translate('Error Message', 'Value Error:') + ' loadbackground() {0}').format(str(e)),getattr(exc_tb, 'tb_lineno', '?'))

0 commit comments

Comments
 (0)