Browse Source

if an error occurs on the server, the module croaks with the error the server gave

Gordon Child 14 years ago
parent
commit
8bcd0952b5
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lib/Selenium/Remote/Driver.pm

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

@@ -245,7 +245,12 @@ sub _execute_command {
                if($resp->{cmd_error}) {
                  $msg .= ": $resp->{cmd_error}" if $resp->{cmd_error};
                } else {
-                   $msg .= ": $resp->{cmd_return}";
+                   if(ref($resp->{cmd_return}) eq 'HASH') {
+                     $msg .= ": $resp->{cmd_return}->{error}->{msg}" 
+                       if $resp->{cmd_return}->{error}->{msg};
+                   } else {
+                     $msg .= ": $resp->{cmd_return}";
+                   }
                }
                croak $msg;
             }