[wp-trac] [WordPress Trac] #65058: Abilities API: Catch exceptions thrown by ability callbacks

WordPress Trac noreply at wordpress.org
Thu Apr 16 07:22:41 UTC 2026


#65058: Abilities API: Catch exceptions thrown by ability callbacks
-------------------------------------------------+-------------------------
 Reporter:  gziolo                               |       Owner:  gziolo
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  7.0
Component:  AI                                   |     Version:  6.9
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  abilities-api has-patch has-unit-    |     Focuses:
  tests commit dev-reviewed                      |
-------------------------------------------------+-------------------------
Changes (by gziolo):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"62238" 62238]:
 {{{
 #!CommitTicketReference repository="" revision="62238"
 Abilities API: Catch exceptions thrown by ability callbacks and return
 WP_Error.

 Wraps `invoke_callback()` in a try/catch so that exceptions thrown by
 execute or permission callbacks are converted to a `WP_Error` with the
 `ability_callback_exception` code instead of propagating as uncaught
 throwables.

 Developed in: https://github.com/WordPress/wordpress-develop/pull/11544

 Props priyankagusani, jamesgiroux, jeffpaul, dkotter, adamsilverstein,
 justlevine, jorbin, pavanpatil1.
 Fixes #65058.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/65058#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list