You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In b2luigi.core.utils.map_folder an exception is re-raised with a modified exception message, where the original message is appended viaex.message.
exceptAttributeErrorasex:
raisetype(ex)(
"Could not determine the current script location. ""If you are running in an interactive shell (such as jupyter notebook) ""make sure to only provide absolute paths in your settings.\nMore Info:\n"+ex.message
).with_traceback(sys.exc_info()[2])
I get an error in python 3.9 that the exception has no message property, but this seems to be already deprecated since python 2.6 (see PEP-352).
The obvious solution would be to just use the str(ex) or a format string like f"More info: {ex}". But before fixing this in a PR, my questions is what's the "best" way to re-raise an exception with a modified message in python 3. The raise type(ex)(...).with_traceback(...) construct seems a bit cumbersome to me, is it really necessary? I admit I don't fully understand it, maybe @FelixMetzner who introduced this code in #34 (thanks for that) can help.
The text was updated successfully, but these errors were encountered:
If you raise an exception within handling another exception, both stack traces and exception messages will be shown (... while handling ...).
You can also choose what is shown with something like raise Ex1 from Ex2, but that should not be necessary here (as the outer exception is the default)
In b2luigi.core.utils.map_folder an exception is re-raised with a modified exception message, where the original message is appended via
ex.message
.I get an error in python 3.9 that the exception has no
message
property, but this seems to be already deprecated since python 2.6 (see PEP-352).The obvious solution would be to just use the
str(ex)
or a format string likef"More info: {ex}"
. But before fixing this in a PR, my questions is what's the "best" way to re-raise an exception with a modified message in python 3. Theraise type(ex)(...).with_traceback(...)
construct seems a bit cumbersome to me, is it really necessary? I admit I don't fully understand it, maybe @FelixMetzner who introduced this code in #34 (thanks for that) can help.The text was updated successfully, but these errors were encountered: