You are here

protected function BrowserBase::getErrorClass in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php \Zumba\GastonJS\Browser\BrowserBase::getErrorClass()

Parameters

$error:

Return value

BrowserError

1 call to BrowserBase::getErrorClass()
BrowserBase::command in vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php
Sends a command to the browser

File

vendor/jcalderonzumba/gastonjs/src/Browser/BrowserBase.php, line 109

Class

BrowserBase
Class BrowserBase @package Zumba\GastonJS\Browser

Namespace

Zumba\GastonJS\Browser

Code

protected function getErrorClass($error) {
  $errorClassMap = array(
    'Poltergeist.JavascriptError' => "Zumba\\GastonJS\\Exception\\JavascriptError",
    'Poltergeist.FrameNotFound' => "Zumba\\GastonJS\\Exception\\FrameNotFound",
    'Poltergeist.InvalidSelector' => "Zumba\\GastonJS\\Exception\\InvalidSelector",
    'Poltergeist.StatusFailError' => "Zumba\\GastonJS\\Exception\\StatusFailError",
    'Poltergeist.NoSuchWindowError' => "Zumba\\GastonJS\\Exception\\NoSuchWindowError",
    'Poltergeist.ObsoleteNode' => "Zumba\\GastonJS\\Exception\\ObsoleteNode",
  );
  if (isset($error['error']['name']) && isset($errorClassMap[$error["error"]["name"]])) {
    return new $errorClassMap[$error["error"]["name"]]($error);
  }
  return new BrowserError($error);
}