annotate vendor/jcalderonzumba/gastonjs/src/Exception/BrowserError.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Zumba\GastonJS\Exception;
Chris@0 4
Chris@0 5
Chris@0 6 /**
Chris@0 7 * Class BrowserError
Chris@0 8 * @package Zumba\GastonJS\Exception
Chris@0 9 */
Chris@0 10 class BrowserError extends ClientError {
Chris@0 11
Chris@0 12 /**
Chris@0 13 * @param array $response
Chris@0 14 */
Chris@0 15 public function __construct($response) {
Chris@0 16 parent::__construct($response);
Chris@0 17 $this->message = $this->message();
Chris@0 18 }
Chris@0 19
Chris@0 20 /**
Chris@0 21 * Gets the name of the browser error
Chris@0 22 * @return string
Chris@0 23 */
Chris@0 24 public function getName() {
Chris@0 25 return $this->response["error"]["name"];
Chris@0 26 }
Chris@0 27
Chris@0 28 /**
Chris@0 29 * @return JSErrorItem
Chris@0 30 */
Chris@0 31 public function javascriptError() {
Chris@0 32 //TODO: this need to be check, i don't know yet what comes in response
Chris@0 33 return new JSErrorItem($this->response["error"]["args"][0], $this->response["error"]["args"][1]);
Chris@0 34 }
Chris@0 35
Chris@0 36 /**
Chris@0 37 * Returns error message
Chris@0 38 * TODO: check how to proper implement if we have exceptions
Chris@0 39 * @return string
Chris@0 40 */
Chris@0 41 public function message() {
Chris@0 42 return "There was an error inside the PhantomJS portion of GastonJS.\nThis is probably a bug, so please report it:\n" . $this->javascriptError();
Chris@0 43 }
Chris@0 44 }