Skip to content

Commit

Permalink
Merge pull request #1107 from City-of-Helsinki/UHF-X-fix-sentry-error
Browse files Browse the repository at this point in the history
Check exception type
  • Loading branch information
hyrsky authored Dec 4, 2024
2 parents 7078104 + 4c53409 commit 55ad92d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use Drupal\menu_link_content\Plugin\Menu\MenuLinkContent;
use Drupal\node\Entity\Node;
use Drupal\responsive_image\Entity\ResponsiveImageStyle;
use Drupal\views\ViewExecutable;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;

/**
* Retrieve possible theme color palette override.
Expand Down Expand Up @@ -72,9 +73,7 @@ function hdbt_preprocess_html(&$variables): void {
->getCurrentRequest()?->attributes->get('exception');

// Check if the page is error-page and add class error-page for the body.
if (
$page_status?->getStatusCode() > 400
) {
if ($page_status instanceof HttpExceptionInterface && $page_status->getStatusCode() > 400) {
$variables['attributes']['class'][] = 'error-page';
}

Expand Down

0 comments on commit 55ad92d

Please sign in to comment.