The WP_Error class consist of two properties and eight methods. These properties are used internally by the class and you likely won’t be needing these properties as most of the task you want to carry out can be accomplished using the class methods.

if ('POST' == $_SERVER['REQUEST_METHOD'] && !empty($_POST['action']) && $_POST['action'] == 'registration') {
    global $error;
    $error = new WP_Error();
    // the rest of your code

To use the WP_Error class for error handling, firstly instantiate the class follow by the use of the class method. You can add an error message passing the code, message, and data on instantiation.