prints exceptions that occur in Before/After hooks

This should fix http://youtrack.jetbrains.com/issue/RUBY-13540
reviewed by Andrey Vokin
(cherry picked from commit fac860d)
use MessageFactory to log the error message in #tc_exception
reviewed by Andrey Vokin
(cherry picked from commit 9300b8a)
only print exceptions if they have not been handled
reviewed by Andrey Vokin
(cherry picked from commit 4bd990d)
clear @handled_exception before each step
reviewed by Andrey Vokin
(cherry picked from commit 1bd07af)