NoticeHandler::convert_notices_to_exceptions( string $error_code = 'unknown_server_error' )

Convert queued error notices into an exception.


Description Description

For example, Payment methods may add error notices during validate_fields call to prevent checkout. Since we’re not rendering notices at all, we need to convert them to exceptions.

This method will find the first error message and thrown an exception instead. Discards notices once complete.


Parameters Parameters

$error_code

(Optional) Error code for the thrown exceptions.

Default value: 'unknown_server_error'


Top ↑

Source Source

File: packages/woocommerce-blocks/src/StoreApi/Utilities/NoticeHandler.php




Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.