Skip to content

Commit

Permalink
Enable WP_DEBUG to be able to get previous Exception class (#8920)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsingyuc authored Jun 7, 2024
1 parent bbdbafb commit bf558f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/add-add-wc-return-previous-exceptions-filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: add

Add woocommerce-return-previous-exceptions filter
2 changes: 2 additions & 0 deletions includes/class-wc-payment-gateway-wcpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,8 @@ public function process_payment( $order_id ) {
$order->add_order_note( $note );
}

// This allows WC to check if WP_DEBUG mode is enabled before returning previous Exception and expose Exception class name to frontend.
add_filter( 'woocommerce_return_previous_exceptions', '__return_true' );
// Re-throw the exception after setting everything up.
// This makes the error notice show up both in the regular and block checkout.
throw new Exception( WC_Payments_Utils::get_filtered_error_message( $e, $blocked_by_fraud_rules ), 0, $e );
Expand Down

0 comments on commit bf558f8

Please sign in to comment.