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

WordPress Trac noreply at wordpress.org
Thu Apr 16 08:17:11 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                      |
-------------------------------------------------+-------------------------

Comment (by gziolo):

 In [changeset:"62240" 62240]:
 {{{
 #!CommitTicketReference repository="" revision="62240"
 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

 Reviewed by adamsilverstein, justlevine, jorbin.
 Merges [62238] to the 7.0 branch.

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

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


More information about the wp-trac mailing list