From ca2f8738ce72a66061cb8911c77c47ffc4ee104d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 26 Dec 2017 14:41:50 -0300 Subject: [PATCH] Bug 19802: Add stack trace to ease debugging Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart (cherry picked from commit f6f95808d815c6ef5376a5e9d5e238387010dd6d) Signed-off-by: Fridolin Somers --- t/lib/Selenium.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm index 2fcd5d2091..57a553557e 100644 --- a/t/lib/Selenium.pm +++ b/t/lib/Selenium.pm @@ -17,6 +17,8 @@ package t::lib::Selenium; use Modern::Perl; +use Carp qw( croak ); + use C4::Context; use base qw(Class::Accessor); @@ -34,6 +36,15 @@ sub new { $self->{driver} = Selenium::Remote::Driver->new( port => $self->{selenium_port}, remote_server_addr => $self->{selenium_addr}, + error_handler => sub { + my $selenium_error = $_[1]; + print STDERR "\nSTRACE:"; + my $i = 1; + while ( (my @call_details = (caller($i++))) ){ + print STDERR "\t" . $call_details[1]. ":" . $call_details[2] . " in " . $call_details[3]."\n"; + } + print STDERR "\n"; + croak $selenium_error; } ); return bless $self, $class; } -- 2.39.5