Revision: 2426
Author: pekka.klarck
Date: Mon Feb  1 14:29:40 2010
Log: Include the last error to message when 'Wait Until Keyword Succeeds' fails (issue 460)
http://code.google.com/p/robotframework/source/detail?r=2426

Modified:
 /trunk/src/robot/libraries/BuiltIn.py

=======================================
--- /trunk/src/robot/libraries/BuiltIn.py       Mon Jan 18 09:54:46 2010
+++ /trunk/src/robot/libraries/BuiltIn.py       Mon Feb  1 14:29:40 2010
@@ -873,16 +873,20 @@
         """
         timeout = utils.timestr_to_secs(timeout)
         retry_interval = utils.timestr_to_secs(retry_interval)
-        starttime = time.time()
-        while time.time() - starttime < timeout:
+        maxtime = time.time() + timeout
+        error = None
+        while not error:
             try:
                 return self.run_keyword(name, *args)
             except utils.RERAISED_EXCEPTIONS:
                 raise
             except:
-                time.sleep(retry_interval)
-        raise AssertionError("Timeout %s exceeded"
-                             % utils.secs_to_timestr(timeout))
+                if time.time() > maxtime:
+                    error = utils.get_error_message()
+                else:
+                    time.sleep(retry_interval)
+        raise AssertionError("Timeout %s exceeded. The last error was: %s"
+                             % (utils.secs_to_timestr(timeout), error))

     def set_variable_if(self, condition, *values):
         """Sets variable based on the given condition.

Reply via email to