Skip to content

Commit

Permalink
fix handling of failed requests
Browse files Browse the repository at this point in the history
  • Loading branch information
FROGGS committed Mar 27, 2016
1 parent a658282 commit 9c64380
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Selenium/WebDriver/Wire.pm6
Expand Up @@ -721,13 +721,14 @@ method _die(Str $method, Str $command, $response) {
say "Died while doing '$method $command', content:\n";
say $response.content if $response.defined;
say "end of content\n";
return unless $response.defined;
my $o = from-json($response.content);

my $error = $o<value>;
Selenium::WebDriver::X::Error.new(
reason => $error<message>,
reason => $error<message> // '',
screenshot => $error<screen>,
class => $error<class>
class => $error<class> // ''
).throw;
}
=begin markdown
Expand Down Expand Up @@ -773,7 +774,7 @@ method _execute-command(Str $method, Str $command, Hash $params = {}) {
$result = from-json( $response.content );
}
else {
self._die($method, $command, $_);
self._die($method, $command, $response);
warn "FAILED: " ~ $response.status-line if self.debug;
}

Expand Down

0 comments on commit 9c64380

Please sign in to comment.