Problem/Motivation

We introduced extra hardening in the VariationCache but for BC reasons could not throw an exception. We ended up going for a trigger_error with level E_USER_WARNING instead, but writing the tests in a way already that they expect a LogicException. This was achieved by having the tests user a custom error handler. See #3452181: VariationCache needs to be more defensive about cache context manipulation to avoid broken redirects

The goal is to remove this trigger_error in favor of an actual LogicException and to remove the small workaround from the tests.

Steps to reproduce

N/A

Proposed resolution

  1. Convert trigger_error in VariationCache into LogicException
  2. Remove custom error handler and try-catch in VariationCacheTest

Remaining tasks

Wait for D12 branch to become available

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

TBD

Issue fork drupal-3468921

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kristiaanvandeneynde created an issue. See original summary.

naveenvalecha’s picture

Title: Convert trigger_error in VariationCache into a LocigException. » Convert trigger_error in VariationCache into a LogicException.
kristiaanvandeneynde’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

smustgrave’s picture

FYI this one is ready to be worked on

smustgrave’s picture

Issue tags: +fldc26

May be a stretch for Florida camp but lets see if anyone there has interest :)

smustgrave’s picture

Status: Active » Needs review

Took a shot at it

dcam’s picture

Status: Needs review » Needs work

I have limited experience setting custom error handlers, but it looks like we have a few more statements that can be deleted here.

smustgrave’s picture

Status: Needs work » Needs review

Pushed some feedback.

dcam’s picture

Title: Convert trigger_error in VariationCache into a LogicException. » Convert trigger_error in VariationCache into a LogicException
Status: Needs review » Reviewed & tested by the community

I don't have any additional feedback. This looks good.

sivaji_ganesh_jojodae made their first commit to this issue’s fork.

  • godotislate committed c7dc1485 on main
    refactor: #3468921 Convert trigger_error in VariationCache into a...
godotislate’s picture

Status: Reviewed & tested by the community » Fixed

Committed c7dc148 and pushed to main. Thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.