Skip to content

Conversation

vjik
Copy link
Member

@vjik vjik commented Aug 17, 2025

Q A
Is bugfix?
New feature? ✔️
Breaks BC?

@vjik vjik requested a review from a team August 17, 2025 05:39
@vjik vjik added the status:code review The pull request needs review. label Aug 17, 2025
@vjik vjik requested review from a team and roxblnfk August 17, 2025 12:52
@vjik vjik changed the title Add UserExceptionInterface Introduce UserException attribute Aug 17, 2025
Copy link

codecov bot commented Aug 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@59c96e6). Learn more about missing BASE report.
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #153   +/-   ##
=========================================
  Coverage          ?   81.06%           
  Complexity        ?      215           
=========================================
  Files             ?       20           
  Lines             ?      692           
  Branches          ?        0           
=========================================
  Hits              ?      561           
  Misses            ?      131           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@roxblnfk roxblnfk requested a review from a team August 17, 2025 13:57
@samdark samdark requested review from Copilot and roxblnfk August 18, 2025 06:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces the UserException as an attribute that can be used to mark exceptions as user-facing, expanding its functionality beyond just being an exception class. The change allows any exception class to be annotated with #[UserException] to indicate its messages are safe to display to end users.

  • Added UserException::is() static method to check if an exception is user-facing
  • Converted UserException to also function as a PHP attribute
  • Updated templates to use the new is() method instead of instanceof checks

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Exception/UserException.php Enhanced to work as both exception class and attribute, added static is() method
templates/production.php Updated to use UserException::is() instead of instanceof check
tests/Exception/UserException/UserExceptionTest.php Added comprehensive tests for the new functionality
tests/Exception/UserException/NotFoundException.php Created test exception class using the new attribute
tests/Factory/ThrowableResponseFactoryTest.php Code formatting cleanup (method chaining)
CHANGELOG.md Added changelog entry for the new feature

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@vjik vjik requested a review from samdark August 18, 2025 11:46
return true;
}

$attributes = (new ReflectionClass($throwable))->getAttributes(self::class);
Copy link
Member

Choose a reason for hiding this comment

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

Can caching affect performance? e.g long running apps

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it doesn't make sense in the case of exception handling.

@vjik vjik merged commit 2bc9774 into master Aug 18, 2025
22 of 23 checks passed
@vjik vjik deleted the user-exception-interface branch August 18, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants