瀏覽代碼

Merge pull request #392 from ylavoie/add-error-handler-context

Add context to error handler. Fixes #378
George S. Baugh 7 年之前
父節點
當前提交
0b7b018e72
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lib/Selenium/Remote/Driver.pm

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

@@ -788,6 +788,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;
@@ -800,7 +803,7 @@ around '_execute_command' => sub {
     }
     catch {
         if ($self->has_error_handler) {
-            $self->error_handler->($self,$_);
+            $return_value = $self->error_handler->($self,$_,@args);
         }
         else {
             croak $_;