WordPress.org

Make WordPress Core

Ticket #16769: 16769.2.patch

File 16769.2.patch, 654 bytes (added by hakre, 3 years ago)

Making WP_Error extending Exception (Updated)

  • wp-includes/class-wp-error.php

     
    1818 * @package WordPress 
    1919 * @since 2.1.0 
    2020 */ 
    21 class WP_Error { 
     21class WP_Error extends Exception { 
    2222        /** 
    2323         * Stores the list of errors. 
    2424         * 
     
    5656         */ 
    5757        function WP_Error($code = '', $message = '', $data = '') { 
    5858                if ( empty($code) ) 
    59                         return; 
     59                        throw new WP_Error( '', 'Code parameter is missing.' ); 
    6060 
     61                parent::__construct( $message ); 
     62 
    6163                $this->errors[$code][] = $message; 
    6264 
    6365                if ( ! empty($data) )