ソースを参照

Add context to error handler. Fixes #378

Yves Lavoie 7 年 前
コミット
f269c4338a
1 ファイル変更4 行追加1 行削除
  1. 4 1
      lib/Selenium/Remote/Driver.pm

+ 4 - 1
lib/Selenium/Remote/Driver.pm

@@ -780,6 +780,9 @@ sub DEMOLISH {
 
 # We install an 'around' because we can catch more exceptions this way
 # than simply wrapping the explicit croaks in _execute_command.
+# @args should be fed to the handler to provide context
+# return_value could be assigned from the handler if we want to allow the
+# error_handler to handle the errors
 
 around '_execute_command' => sub {
     my $orig = shift;
@@ -792,7 +795,7 @@ around '_execute_command' => sub {
     }
     catch {
         if ($self->has_error_handler) {
-            $self->error_handler->($self,$_);
+            return $self->error_handler->($self,$_,@args);
         }
         else {
             croak $_;