Skip to content

Commit f42cce7

Browse files
committed
[smarcet]
* added conflict exception for makeRequest ( 409 http code )
1 parent c3462b5 commit f42cce7

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/Facade/CalDavClient.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* limitations under the License.
1414
**/
1515

16+
use CalDAVClient\Facade\Exceptions\ConflictException;
1617
use CalDAVClient\Facade\Exceptions\ForbiddenException;
1718
use CalDAVClient\Facade\Requests\CalDAVRequestFactory;
1819
use CalDAVClient\Facade\Requests\CalendarQueryFilter;
@@ -138,6 +139,7 @@ public function setAuthenticationType($authtype) {
138139
/**
139140
* @param Request $http_request
140141
* @return mixed|\Psr\Http\Message\ResponseInterface
142+
* @throws \GuzzleHttp\Exception\GuzzleException
141143
*/
142144
private function makeRequest(Request $http_request){
143145
try{
@@ -151,11 +153,13 @@ private function makeRequest(Request $http_request){
151153
case 401:
152154
throw new UserUnAuthorizedException();
153155
break;
156+
case 403:
157+
throw new ForbiddenException();
154158
case 404:
155159
throw new NotFoundResourceException();
156160
break;
157-
case 403:
158-
throw new ForbiddenException();
161+
case 409:
162+
throw new ConflictException();
159163
default:
160164
throw new ServerErrorException($ex->getMessage(), $ex->getCode());
161165
break;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php namespace CalDAVClient\Facade\Exceptions;
2+
/**
3+
* Copyright 2018 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
/**
15+
* Class ConflictException
16+
* @package CalDAVClient\Facade\Exceptions
17+
*/
18+
final class ConflictException extends \RuntimeException
19+
{
20+
21+
}

0 commit comments

Comments
 (0)