Problem/Motivation

Steps to reproduce

Trigger an error in the Klaro callback JS code, e.g. enable the Posthog service, but do not use posthog.

Result: A JS error occurs and the Klaro banner is NOT shown!

Proposed resolution

Catch any kind of errors inside the callback code, ensure the Klaro banner is shown and then re-trigger the errors for the console.

Ensure the general functionality can never be broken by defective callback scripts

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork klaro-3567998

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

anybody created an issue. See original summary.

grevil’s picture

Title: Errors in callback code shoult not kill the Klaro consent banner » Errors in callback code should not kill the Klaro consent banner

grevil’s picture

Status: Active » Needs review
StatusFileSize
new24.44 KB
new27.24 KB

This should be it! Please review!

Before (Banner not showing):
screenshot

After (Banner showing):
screenshot2

anybody’s picture

Status: Needs review » Reviewed & tested by the community

Thanks @grevil! That was exactly what I thought about.

We could theoretically even add a test to ensure the banner is not more broken, if the callback throws an error.

Let @Jan Kellermann decide...

lrwebks’s picture

StatusFileSize
new701 bytes

Static patch until this is merged

anybody’s picture

Would be great if a maintainer could review this.

jan kellermann’s picture

Status: Reviewed & tested by the community » Fixed

I merged your code for next klaro release. Thank you very much.

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.