Skip to content

Commit 33abf63

Browse files
committed
add separate request exception with returned prestashop xml error
rename exception to be consistent (WebService vs Webservice)
1 parent 96be025 commit 33abf63

File tree

5 files changed

+132
-83
lines changed

5 files changed

+132
-83
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Protechstudio\PrestashopWebService\Exceptions;
4+
5+
class PrestashopWebServiceException extends \Exception
6+
{
7+
8+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Protechstudio\PrestashopWebService\Exceptions;
4+
5+
class PrestashopWebServiceRequestException extends PrestashopWebServiceException
6+
{
7+
static protected $label = 'This call to PrestaShop Web Services failed and returned an HTTP status of %d. That means: %s.';
8+
9+
protected $response;
10+
11+
public function __construct($message = null, $code = null, $response = null)
12+
{
13+
parent::__construct(sprintf(static::$label, $code, $message), $code);
14+
15+
$this->response = $response;
16+
}
17+
18+
public function hasResponse()
19+
{
20+
return isset($this->response) && !empty($this->response);
21+
}
22+
23+
public function getResponse()
24+
{
25+
return $this->response;
26+
}
27+
}

src/PrestaShopWebserviceException.php

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)