protected function addError($code, $extraDetails = null)
    {
        // modified from parent function to support changing the error class
        $errorClass = $this->getSchemaValidationErrorClass();
        $this->errors[] = new $errorClass($code, $extraDetails);
    }