diff --git a/public/modules/custom/asu_content/src/Entity/Project.php b/public/modules/custom/asu_content/src/Entity/Project.php index 0b3784356..299870d34 100644 --- a/public/modules/custom/asu_content/src/Entity/Project.php +++ b/public/modules/custom/asu_content/src/Entity/Project.php @@ -182,9 +182,19 @@ public function getUserReservations($userId): array { $request->setSender($user); $backendApi = \Drupal::service('asu_api.backendapi'); - $userReservations = $backendApi - ->send($request) - ->getContent(); + try { + $userReservations = $backendApi + ->send($request) + ->getContent(); + if (!$userReservations) { + return []; + } + return $userReservations; + } + catch (\Exception $e) { + \Drupal::logger('asu_application')->error('Error when fetching reservations for user #' . $userId); + return []; + } return $userReservations; }