JavascriptError.php in Zircon Profile 8.0
File
vendor/jcalderonzumba/gastonjs/src/Exception/JavascriptError.php
View source
<?php
namespace Zumba\GastonJS\Exception;
class JavascriptError extends ClientError {
public function __construct($response) {
parent::__construct($response);
$this->message = $this
->message();
}
public function javascriptErrors() {
$jsErrors = array();
$errors = $this->response["error"]["args"][0];
foreach ($errors as $error) {
$jsErrors[] = new JSErrorItem($error["message"], $error["stack"]);
}
return $jsErrors;
}
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).";
$jsErrors = $this
->javascriptErrors();
foreach ($jsErrors as $jsError) {
$error = "{$error}\n{$jsError}";
}
return $error;
}
}