Skip to content

Commit

Permalink
Merge remote-tracking branch 'ezsystems/2.3' into temp_2.3_to_4.5
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/lib/Resolver/SectionResolver.php
  • Loading branch information
mateuszdebinski committed Aug 9, 2023
2 parents 871251d + d4a9610 commit a29cc3a
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 a29cc3a

Please sign in to comment.