Skip to content

Add tests for CompatForm::logAndShowError() - #394

Draft
jrauh01 wants to merge 2 commits into
mainfrom
tests/log-form-errors
Draft

Add tests for CompatForm::logAndShowError()#394
jrauh01 wants to merge 2 commits into
mainfrom
tests/log-form-errors

Conversation

@jrauh01

@jrauh01 jrauh01 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

These are the tests for CompatForm::logAndShowError(), split off into their own branch because they can't run yet: our test bootstrap has no autoloadable Icinga\Application\Logger, which the method calls unconditionally, so running them currently fails with Class "Icinga\Application\Logger" not found. This is opened as a draft so the tests aren't lost in the meantime. Once the test structure is updated to provide (or stub) that class, this can be rebased and merged.

ref #393

jrauh01 added 2 commits July 1, 2026 10:19
Subclasses that catch an exception or otherwise fail during processing
previously had to repeat the same three steps by hand:

1. log the error
2. add it as a form message
3. call `onError()` to mark the form as failed

`logAndShowError()` bundles this into one call.

Exceptions are logged with their confidential stack trace (argument values
redacted, types only) via `IcingaException::getConfidentialTraceAsString()`,
so call sites don't need to worry about leaking sensitive data into the log.
Plain strings and `Stringable` messages are logged as-is.
@cla-bot cla-bot Bot added the cla/signed label Jul 1, 2026
@jrauh01
jrauh01 marked this pull request as draft July 1, 2026 08:30
Base automatically changed from feature/log-form-errors to main July 1, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant