Skip to content

ext/tidy: throwing exception instead of warning for php calls.#19417

Open
devnexen wants to merge 1 commit intophp:masterfrom
devnexen:tidy_to_exception
Open

ext/tidy: throwing exception instead of warning for php calls.#19417
devnexen wants to merge 1 commit intophp:masterfrom
devnexen:tidy_to_exception

Conversation

@devnexen
Copy link
Copy Markdown
Member

@devnexen devnexen commented Aug 8, 2025

Also using less generic exception type while at it.

Also using less generic exception type while at it.
@devnexen devnexen marked this pull request as ready for review August 8, 2025 12:16
@devnexen devnexen requested a review from kocsismate as a code owner August 8, 2025 12:16
@ndossche
Copy link
Copy Markdown
Member

This probably needs an RFC

@devnexen
Copy link
Copy Markdown
Member Author

ah yes the "new" exception falls into the category.

Comment thread ext/tidy/tidy.stub.php
const TIDY_TAG_VIDEO = UNKNOWN;
# endif

class TidyException extends Exception
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
class TidyException extends Exception
/** @strict-properties */
class TidyException extends Exception

try {
$tidy->parseFile("does_not_exist.html");
} catch (Throwable $e) {
echo $e::class . '::' . $e->getMessage(), PHP_EOL;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
echo $e::class . '::' . $e->getMessage(), PHP_EOL;
echo $e::class, ': ', $e->getMessage(), PHP_EOL;

This renders a little nicer.

@ndossche ndossche self-requested a review as a code owner March 14, 2026 14:04
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.

3 participants