send_transactional_email try catch block

This commit is contained in:
Mike Jolley 2017-04-13 14:22:07 +01:00
parent 712e84251d
commit 180f5cd40b
1 changed files with 9 additions and 3 deletions

View File

@ -139,9 +139,15 @@ class WC_Emails {
* @param array $args Email args (default: []). * @param array $args Email args (default: []).
*/ */
public static function send_transactional_email( $args = array() ) { public static function send_transactional_email( $args = array() ) {
try {
$args = func_get_args(); $args = func_get_args();
self::instance(); // Init self so emails exist. self::instance(); // Init self so emails exist.
do_action_ref_array( current_filter() . '_notification', $args ); do_action_ref_array( current_filter() . '_notification', $args );
} catch ( Exception $e ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
trigger_error( 'Transactional email triggered fatal error for callback ' . current_filter(), E_USER_WARNING );
}
}
} }
/** /**