class JavascriptError in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/jcalderonzumba/gastonjs/src/Exception/JavascriptError.php \Zumba\GastonJS\Exception\JavascriptError
Class JavascriptError @package Zumba\GastonJS\Exception
Hierarchy
- class \Zumba\GastonJS\Exception\ClientError extends \Zumba\GastonJS\Exception\Exception
- class \Zumba\GastonJS\Exception\JavascriptError
Expanded class hierarchy of JavascriptError
File
- vendor/
jcalderonzumba/ gastonjs/ src/ Exception/ JavascriptError.php, line 10
Namespace
Zumba\GastonJS\ExceptionView source
class JavascriptError extends ClientError {
/**
* @param array $response
*/
public function __construct($response) {
parent::__construct($response);
$this->message = $this
->message();
}
/**
* Get the javascript errors found during the use of the phantomjs
* @return array
*/
public function javascriptErrors() {
$jsErrors = array();
$errors = $this->response["error"]["args"][0];
foreach ($errors as $error) {
$jsErrors[] = new JSErrorItem($error["message"], $error["stack"]);
}
return $jsErrors;
}
/**
* Returns the javascript errors found
* @return string
*/
public function message() {
$error = "One or more errors were raised in the Javascript code on the page.\n If you don't care about these errors, you can ignore them by\n setting js_errors: false in your Poltergeist configuration (see documentation for details).";
//TODO: add javascript errors
$jsErrors = $this
->javascriptErrors();
foreach ($jsErrors as $jsError) {
$error = "{$error}\n{$jsError}";
}
return $error;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ClientError:: |
protected | property | @var mixed | |
ClientError:: |
public | function | ||
ClientError:: |
public | function | ||
JavascriptError:: |
public | function | Get the javascript errors found during the use of the phantomjs | |
JavascriptError:: |
public | function | Returns the javascript errors found | |
JavascriptError:: |
public | function |
Overrides ClientError:: |