pantheon-systems/pantheon-advanced-page-cache

Catch Exceptions thrown by the `pantheon_clear_edge_*` functions

danielbachhuber opened this issue · 0 comments

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'Unexpected result from Pantheon API when attempting to PURGE edge cache.' in /srv/includes/pantheon.php:564 Stack trace: #0 /srv/bindings/9778ff1085024e09bba29535c495d40b/code/wp-content/plugins/pantheon-integrated-cdn/pantheon-integrated-cdn.php(30): pantheon_clear_edge_keys(Array) #1 /srv/bindings/9778ff1085024e09bba29535c495d40b/code/wp-content/plugins/pantheon-integrated-cdn/inc/class-purger.php(128): pantheon_wp_clear_edge_keys(Array) #2 /srv/bindings/9778ff1085024e09bba29535c495d40b/code/wp-content/plugins/pantheon-integrated-cdn/inc/class-purger.php(21): Pantheon_Integrated_CDN\Purger::purge_post_with_related(74) #3 [internal function]: Pantheon_Integrated_CDN\Purger::action_wp_insert_post(74) #4 /srv/bindings/9778ff1085024e09bba29535c495d40b/code/wp-includes/plugin.php(524): call_user_func_array(Array, Array) #5 /srv/bindings/9778ff1085024e09bba29535c495d40b/code/wp-includes/post.php(3420): do_action('wp_insert_post', 74, Object(WP_Post), tru in /srv/includes/pantheon.php on line 564 

We should catch exceptions like these, and return WP_Error objects instead.