fix regression in logging runpython errors
In commit fa044e011d
we caught OSError and
started emitting a special error message disclaiming that it probably
isn't Meson's fault, and skipping the generic "This is a meson bug and
should be reported" handler.
But, we no longer did this after verifying that the command *isn't*
runpython, so arbitrary scripts that raised OSError would start saying
stuff about Meson, which was wrong.
Start checking for runpython first.
This commit is contained in:
parent
28103614ef
commit
389b2f6785
|
@ -49,7 +49,9 @@ def errorhandler(e, command):
|
||||||
raise e
|
raise e
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
if isinstance(e, OSError):
|
if command == 'runpython':
|
||||||
|
return 2
|
||||||
|
elif isinstance(e, OSError):
|
||||||
error_msg = os.linesep.join([
|
error_msg = os.linesep.join([
|
||||||
"Unhandled python exception",
|
"Unhandled python exception",
|
||||||
f"{e.strerror} - {e.args}",
|
f"{e.strerror} - {e.args}",
|
||||||
|
@ -58,13 +60,12 @@ def errorhandler(e, command):
|
||||||
mlog.exception(error_msg)
|
mlog.exception(error_msg)
|
||||||
return e.errno
|
return e.errno
|
||||||
else: # Exception
|
else: # Exception
|
||||||
if command != 'runpython':
|
msg = 'Unhandled python exception'
|
||||||
msg = 'Unhandled python exception'
|
if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
|
||||||
if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
|
e = MesonBugException(msg, e.file, e.lineno, e.colno) # type: ignore
|
||||||
e = MesonBugException(msg, e.file, e.lineno, e.colno) # type: ignore
|
else:
|
||||||
else:
|
e = MesonBugException(msg)
|
||||||
e = MesonBugException(msg)
|
mlog.exception(e)
|
||||||
mlog.exception(e)
|
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
# Note: when adding arguments, please also add them to the completion
|
# Note: when adding arguments, please also add them to the completion
|
||||||
|
|
Loading…
Reference in New Issue