Wrap read with try catch block
This commit is contained in:
parent
c473190756
commit
1d9f71fee5
|
@ -100,7 +100,12 @@ class WC_Customer extends WC_Legacy_Customer {
|
||||||
|
|
||||||
// If we have an ID, load the user from the DB.
|
// If we have an ID, load the user from the DB.
|
||||||
if ( $this->get_id() ) {
|
if ( $this->get_id() ) {
|
||||||
|
try {
|
||||||
$this->data_store->read( $this );
|
$this->data_store->read( $this );
|
||||||
|
} catch ( Exception $e ) {
|
||||||
|
$this->set_id( 0 );
|
||||||
|
$this->set_object_read( true );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->set_object_read( true );
|
$this->set_object_read( true );
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,7 @@ class WC_Customer_Data_Store extends WC_Data_Store_WP implements WC_Customer_Dat
|
||||||
*
|
*
|
||||||
* @since 2.7.0
|
* @since 2.7.0
|
||||||
* @param WC_Customer
|
* @param WC_Customer
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function read( &$customer ) {
|
public function read( &$customer ) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
Loading…
Reference in New Issue