Skip to content

Commit

Permalink
Merge pull request #55 from ibexa/temp_2.3_to_4.5
Browse files Browse the repository at this point in the history
Merge branch '2.3' of ezsystems/ezplatform-graphql into 4.5
  • Loading branch information
Konrad Oboza committed Aug 9, 2023
2 parents 871251d + a29cc3a commit 0d5bbba
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lib/Resolver/SectionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
*/
namespace Ibexa\GraphQL\Resolver;

use GraphQL\Error\UserError;
use Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException;
use Ibexa\Contracts\Core\Repository\SectionService;
use Ibexa\Contracts\Core\Repository\Values\Content\Section;

/**
* @internal
Expand All @@ -23,9 +26,13 @@ public function __construct(SectionService $sectionService)
$this->sectionService = $sectionService;
}

public function resolveSectionById($sectionId)
public function resolveSectionById($sectionId): ?Section
{
return $this->sectionService->loadSection($sectionId);
try {
return $this->sectionService->loadSection($sectionId);
} catch (UnauthorizedException $e) {
throw new UserError($e->getMessage());
}
}
}

Expand Down

0 comments on commit 0d5bbba

Please sign in to comment.