HomeDevCentral

Extract Python error from an exception with traceback

Description

Extract Python error from an exception with traceback

Summary:
.+surname and .+givenname can sometimes fail with a
pywikibot.data.api.APIError thrown.

If we were in a pure Python context we could nicely catch
those errors.

Currently, from our TCL interpreter, we instead receive a text output.

A callback method is provided to parse this output to print error.

Fixes T1203.

Test Plan:
With a test_exception raising a TypeError containing the text of the actual error
(so we can be sure we catch the REAL exception, not an embedded text looking like an exception):
run_command "python /home/surfboard/bin/test_exception" print_command_callback print_python_error_callback {dcc 14}
run_command "python /home/surfboard/bin/test_exception" print_command_callback print_python_error_callback {quick #pentacle}

Reviewers: dereckson

Reviewed By: dereckson

Subscribers: Ash-Crow

Maniphest Tasks: T1203

Differential Revision: https://devcentral.nasqueron.org/D984