Outlook Cal Sync Token revocation error

Added code to manage and let user know
that token was revoked on Outlook cal Sync

Change-Id: I16ba807cbfebb9ef63bb799489cb1f2b1bdfd22c
This commit is contained in:
Sebastian Marcet 2018-06-04 10:36:53 -07:00
parent cb0d0c2618
commit d9b79b3bac
1 changed files with 16 additions and 0 deletions

View File

@ -11,6 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
use App\Services\Apis\CalendarSync\Exceptions\RevokedAccessException;
use models\summit\CalendarSync\CalendarSyncInfo;
use models\summit\CalendarSync\CalendarSyncInfoOAuth2;
use models\summit\CalendarSync\ScheduleCalendarSyncInfo;
@ -145,6 +146,7 @@ final class OutlookCalendarSyncRemoteFacade
/**
* @param MemberEventScheduleSummitActionSyncWorkRequest $request
* @return ScheduleCalendarSyncInfo
* @throws RevokedAccessException
*/
public function addEvent(MemberEventScheduleSummitActionSyncWorkRequest $request)
{
@ -166,6 +168,10 @@ final class OutlookCalendarSyncRemoteFacade
$sync_info->setLocationId($summit_event->getLocationId());
return $sync_info;
}
catch (LogicException $ex1){
Log::warning($ex1);
throw new RevokedAccessException($ex1->getMessage());
}
catch (Exception $ex){
Log::error($ex);
return null;
@ -176,6 +182,7 @@ final class OutlookCalendarSyncRemoteFacade
* @param MemberEventScheduleSummitActionSyncWorkRequest $request
* @param ScheduleCalendarSyncInfo $schedule_sync_info
* @return bool
* @throws RevokedAccessException
*/
public function deleteEvent
(
@ -187,6 +194,10 @@ final class OutlookCalendarSyncRemoteFacade
$res = $this->client->deleteEvent($schedule_sync_info->getExternalId());
return !($res instanceof ErrorResponse);
}
catch (LogicException $ex1){
Log::warning($ex1);
throw new RevokedAccessException($ex1->getMessage());
}
catch (Exception $ex){
Log::error($ex);
return false;
@ -197,6 +208,7 @@ final class OutlookCalendarSyncRemoteFacade
* @param MemberEventScheduleSummitActionSyncWorkRequest $request
* @param ScheduleCalendarSyncInfo $schedule_sync_info
* @return bool
* @throws RevokedAccessException
*/
public function updateEvent
(
@ -216,6 +228,10 @@ final class OutlookCalendarSyncRemoteFacade
$schedule_sync_info->setLocationId($summit_event->getLocationId());
return true;
}
catch (LogicException $ex1){
Log::warning($ex1);
throw new RevokedAccessException($ex1->getMessage());
}
catch (Exception $ex){
Log::error($ex);
return false;