diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2022-04-22 16:28:12 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2022-04-22 18:18:46 +0200 |
commit | 49dfec0a061ca4595a3c5122e92e6a5524cb768b (patch) | |
tree | ff502a33e0a7f946475088a63fb311cdff9cd034 /wizards | |
parent | d5986d1c5f639f21204412ebe4a2a9487088b2f3 (diff) |
Access2Base - (access2base.py) Don't use bare except: statement
The exception hierarchy described on page
https://docs.python.org/3.5/library/exceptions.html#exception-hierarchy
indicates that the default exception in bare
except:
statements is BaseException. This induces that the SystemExit,
KeyboardInterrupt and GeneratorExit are also handled by the
user script.
This is a not recommended practice.
Better is to use the explicit Exception built-in exception
except Exception:
Bug reported by Paul M on Telegram
Change-Id: Ie1ae1f732ebc60a881e7d40ba8141aa704e9cd5c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133328
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r-- | wizards/source/access2base/access2base.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wizards/source/access2base/access2base.py b/wizards/source/access2base/access2base.py index 00b9c894488d..ce88057247e1 100644 --- a/wizards/source/access2base/access2base.py +++ b/wizards/source/access2base/access2base.py @@ -43,7 +43,7 @@ from platform import system as _opsys import datetime, os, sys, traceback _LIBRARY = '' # Should be 'Access2Base' or 'Access2BaseDev' -_VERSION = '7.1' # Actual version number +_VERSION = '7.4' # Actual version number _WRAPPERMODULE = 'Python' # Module name in the Access2Base library containing Python interfaces # CallByName types @@ -608,7 +608,7 @@ class _A2B(object, metaclass = _Singleton): Script = cls.xScript(script, module) try: Returned = Script.invoke((args), (), ())[0] - except: + except Exception: raise TypeError("Access2Base error: method '" + script + "' in Basic module '" + module + "' call error. Check its arguments.") else: if Returned == None: @@ -643,7 +643,7 @@ class _A2B(object, metaclass = _Singleton): args = (action,) + (basic,) + (script,) + args try: Returned = Script.invoke((args), (), ()) - except: + except Exception: raise TypeError("Access2Base error: method '" + script + "' call error. Check its arguments.") if isinstance(Returned[0], tuple): |