How to capture unexpected error messages/warnings

Asked by Anshu

Is there any way to capture the message box or warning contents that would appear - when a test case fails.
For example if my testcase is to save a file by name test.abc , and that file already exists , i get an error message , which is handled by try ..except - so as to continue the test execution and return the pass/fail status.
But how do i capture the text(log) of error message - which can help to identify the failure cause ?

Thanks
Anshu

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

after an exception is raised, sys.exc_info contains all information about the error.

returns(type, value, traceback) --- their meaning:
Their meaning is: type gets the exception type of the exception being handled (a class object); value gets the exception parameter (its associated value or the second argument to raise, which is always a class instance if the exception type is a class object); traceback gets a traceback object (see the Reference Manual) which encapsulates the call stack at the point where the exception originally occurred.

(from Python doc: http://docs.python.org/library/sys.html)

I have a private def() to evaluate exc_info and print short, relevant info to stdout.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

one more thing:
in general use -s on the commandline, to avoid the message box and get the error info printed to stdout.

Can you help with this problem?

Provide an answer of your own, or ask Anshu for more information if necessary.

To post a message you must log in.