Skip to content

Commit d37d240

Browse files
committed
[smarcet]
* added exception info to ConflictException
1 parent f42cce7 commit d37d240

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

src/Facade/CalDavClient.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ private function makeRequest(Request $http_request){
159159
throw new NotFoundResourceException();
160160
break;
161161
case 409:
162-
throw new ConflictException();
162+
throw new ConflictException($ex->getMessage(), $ex->getCode());
163163
default:
164164
throw new ServerErrorException($ex->getMessage(), $ex->getCode());
165165
break;
@@ -169,6 +169,7 @@ private function makeRequest(Request $http_request){
169169

170170
/**
171171
* @return bool
172+
* @throws \GuzzleHttp\Exception\GuzzleException
172173
*/
173174
public function isValidServer()
174175
{
@@ -208,6 +209,7 @@ public function getUserPrincipal()
208209
/**
209210
* @param string $principal_url
210211
* @return CalendarHomesResponse
212+
* @throws \GuzzleHttp\Exception\GuzzleException
211213
*/
212214
public function getCalendarHome($principal_url)
213215
{
@@ -227,6 +229,7 @@ public function getCalendarHome($principal_url)
227229
* @param MakeCalendarRequestVO $vo
228230
* @see https://tools.ietf.org/html/rfc4791#section-5.3.1
229231
* @return string|boolean
232+
* @throws \GuzzleHttp\Exception\GuzzleException
230233
*/
231234
public function createCalendar($calendar_home_set, MakeCalendarRequestVO $vo)
232235
{
@@ -248,6 +251,7 @@ public function createCalendar($calendar_home_set, MakeCalendarRequestVO $vo)
248251
/**
249252
* @param string $calendar_home_set_url
250253
* @return GetCalendarsResponse
254+
* @throws \GuzzleHttp\Exception\GuzzleException
251255
*/
252256
public function getCalendars($calendar_home_set_url)
253257
{
@@ -265,6 +269,7 @@ public function getCalendars($calendar_home_set_url)
265269
/**
266270
* @param string $calendar_url
267271
* @return GetCalendarResponse
272+
* @throws \GuzzleHttp\Exception\GuzzleException
268273
*/
269274
public function getCalendar($calendar_url)
270275
{
@@ -285,6 +290,7 @@ public function getCalendar($calendar_url)
285290
* @param string $calendar_url
286291
* @param string $sync_token
287292
* @return CalendarSyncInfoResponse
293+
* @throws \GuzzleHttp\Exception\GuzzleException
288294
*/
289295
public function getCalendarSyncInfo($calendar_url, $sync_token)
290296
{
@@ -304,6 +310,7 @@ public function getCalendarSyncInfo($calendar_url, $sync_token)
304310
* @param string $calendar_url
305311
* @param EventRequestVO $vo
306312
* @return EventCreatedResponse
313+
* @throws \GuzzleHttp\Exception\GuzzleException
307314
*/
308315
public function createEvent($calendar_url, EventRequestVO $vo)
309316
{
@@ -332,6 +339,7 @@ public function createEvent($calendar_url, EventRequestVO $vo)
332339
* @param EventRequestVO $vo
333340
* @param string $etag
334341
* @return EventUpdatedResponse
342+
* @throws \GuzzleHttp\Exception\GuzzleException
335343
*/
336344
public function updateEvent($calendar_url, EventRequestVO $vo, $etag = null)
337345
{
@@ -361,6 +369,7 @@ public function updateEvent($calendar_url, EventRequestVO $vo, $etag = null)
361369
* @param string $uid
362370
* @param string $etag
363371
* @return EventDeletedResponse
372+
* @throws \GuzzleHttp\Exception\GuzzleException
364373
*/
365374
public function deleteEvent($calendar_url, $uid, $etag = null)
366375
{
@@ -381,6 +390,7 @@ public function deleteEvent($calendar_url, $uid, $etag = null)
381390
/**
382391
* @param string $event_url
383392
* @return string
393+
* @throws \GuzzleHttp\Exception\GuzzleException
384394
*/
385395
public function getEventVCardBy($event_url){
386396
$http_response = $this->makeRequest(
@@ -398,6 +408,7 @@ public function getEventVCardBy($event_url){
398408
* @param string $calendar_url
399409
* @param array $events_urls
400410
* @return ResourceCollectionResponse
411+
* @throws \GuzzleHttp\Exception\GuzzleException
401412
*/
402413
public function getEventsBy($calendar_url, array $events_urls)
403414
{
@@ -421,6 +432,7 @@ public function getEventsBy($calendar_url, array $events_urls)
421432
* @param string $calendar_url
422433
* @param CalendarQueryFilter $filter
423434
* @return ResourceCollectionResponse
435+
* @throws \GuzzleHttp\Exception\GuzzleException
424436
*/
425437
public function getEventsByQuery($calendar_url, CalendarQueryFilter $filter)
426438
{
@@ -445,6 +457,7 @@ public function getEventsByQuery($calendar_url, CalendarQueryFilter $filter)
445457
* @param string $calendar_url
446458
* @param string|null $etag
447459
* @return CalendarDeletedResponse
460+
* @throws \GuzzleHttp\Exception\GuzzleException
448461
*/
449462
public function deleteCalendar($calendar_url, $etag = null)
450463
{

src/Facade/Exceptions/ConflictException.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
1313
**/
14+
use RuntimeException;
15+
use Throwable;
1416
/**
17+
*
1518
* Class ConflictException
1619
* @package CalDAVClient\Facade\Exceptions
1720
*/
18-
final class ConflictException extends \RuntimeException
21+
final class ConflictException extends RuntimeException
1922
{
20-
23+
public function __construct($message = "", $code = 0, Throwable $previous = null)
24+
{
25+
parent::__construct($message, $code, $previous);
26+
}
2127
}

src/Facade/Exceptions/ServerErrorException.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
**/
1414
use RuntimeException;
1515
use Throwable;
16-
1716
/**
1817
* Class ServerErrorException
1918
* @package Facade\Exceptions

0 commit comments

Comments
 (0)