Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/4.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszdebinski committed Aug 9, 2023
2 parents 940207b + 0d5bbba commit 985b72d
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 985b72d

Please sign in to comment.