Page MenuHomeDevCentral

Extract Python error from an exception with traceback
ClosedPublic

Authored by dereckson on May 13 2017, 11:41.
Tags
None
Referenced Files
F22266994: D984.diff
Tue, Jan 27, 14:05
F22266967: D984.id.diff
Tue, Jan 27, 14:05
Unknown Object (File)
Fri, Jan 23, 08:20
Unknown Object (File)
Fri, Jan 23, 06:27
Unknown Object (File)
Thu, Jan 22, 22:03
Unknown Object (File)
Wed, Jan 21, 09:04
Unknown Object (File)
Wed, Jan 21, 04:21
Unknown Object (File)
Tue, Jan 20, 16:25
Subscribers

Details

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}

Diff Detail

Repository
rVIPER ViperServ scripts
Lint
Lint Not Applicable
Unit
Tests Not Applicable