Skip to content

Commit

Permalink
[smarcet]
Browse files Browse the repository at this point in the history
* added exception info to ConflictException
  • Loading branch information
smarcet committed Jun 1, 2018
1 parent f42cce7 commit d37d240
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
15 changes: 14 additions & 1 deletion src/Facade/CalDavClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private function makeRequest(Request $http_request){
throw new NotFoundResourceException();
break;
case 409:
throw new ConflictException();
throw new ConflictException($ex->getMessage(), $ex->getCode());
default:
throw new ServerErrorException($ex->getMessage(), $ex->getCode());
break;
Expand All @@ -169,6 +169,7 @@ private function makeRequest(Request $http_request){

/**
* @return bool
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function isValidServer()
{
Expand Down Expand Up @@ -208,6 +209,7 @@ public function getUserPrincipal()
/**
* @param string $principal_url
* @return CalendarHomesResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getCalendarHome($principal_url)
{
Expand All @@ -227,6 +229,7 @@ public function getCalendarHome($principal_url)
* @param MakeCalendarRequestVO $vo
* @see https://tools.ietf.org/html/rfc4791#section-5.3.1
* @return string|boolean
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function createCalendar($calendar_home_set, MakeCalendarRequestVO $vo)
{
Expand All @@ -248,6 +251,7 @@ public function createCalendar($calendar_home_set, MakeCalendarRequestVO $vo)
/**
* @param string $calendar_home_set_url
* @return GetCalendarsResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getCalendars($calendar_home_set_url)
{
Expand All @@ -265,6 +269,7 @@ public function getCalendars($calendar_home_set_url)
/**
* @param string $calendar_url
* @return GetCalendarResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getCalendar($calendar_url)
{
Expand All @@ -285,6 +290,7 @@ public function getCalendar($calendar_url)
* @param string $calendar_url
* @param string $sync_token
* @return CalendarSyncInfoResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getCalendarSyncInfo($calendar_url, $sync_token)
{
Expand All @@ -304,6 +310,7 @@ public function getCalendarSyncInfo($calendar_url, $sync_token)
* @param string $calendar_url
* @param EventRequestVO $vo
* @return EventCreatedResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function createEvent($calendar_url, EventRequestVO $vo)
{
Expand Down Expand Up @@ -332,6 +339,7 @@ public function createEvent($calendar_url, EventRequestVO $vo)
* @param EventRequestVO $vo
* @param string $etag
* @return EventUpdatedResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function updateEvent($calendar_url, EventRequestVO $vo, $etag = null)
{
Expand Down Expand Up @@ -361,6 +369,7 @@ public function updateEvent($calendar_url, EventRequestVO $vo, $etag = null)
* @param string $uid
* @param string $etag
* @return EventDeletedResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function deleteEvent($calendar_url, $uid, $etag = null)
{
Expand All @@ -381,6 +390,7 @@ public function deleteEvent($calendar_url, $uid, $etag = null)
/**
* @param string $event_url
* @return string
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getEventVCardBy($event_url){
$http_response = $this->makeRequest(
Expand All @@ -398,6 +408,7 @@ public function getEventVCardBy($event_url){
* @param string $calendar_url
* @param array $events_urls
* @return ResourceCollectionResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getEventsBy($calendar_url, array $events_urls)
{
Expand All @@ -421,6 +432,7 @@ public function getEventsBy($calendar_url, array $events_urls)
* @param string $calendar_url
* @param CalendarQueryFilter $filter
* @return ResourceCollectionResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getEventsByQuery($calendar_url, CalendarQueryFilter $filter)
{
Expand All @@ -445,6 +457,7 @@ public function getEventsByQuery($calendar_url, CalendarQueryFilter $filter)
* @param string $calendar_url
* @param string|null $etag
* @return CalendarDeletedResponse
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function deleteCalendar($calendar_url, $etag = null)
{
Expand Down
10 changes: 8 additions & 2 deletions src/Facade/Exceptions/ConflictException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use RuntimeException;
use Throwable;
/**
*
* Class ConflictException
* @package CalDAVClient\Facade\Exceptions
*/
final class ConflictException extends \RuntimeException
final class ConflictException extends RuntimeException
{

public function __construct($message = "", $code = 0, Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
1 change: 0 additions & 1 deletion src/Facade/Exceptions/ServerErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
**/
use RuntimeException;
use Throwable;

/**
* Class ServerErrorException
* @package Facade\Exceptions
Expand Down

0 comments on commit d37d240

Please sign in to comment.