Testing method - set that the connection failed to test error handling. Set this before attempting the query.
@param boolean $fail_connection_failed
198618
public function setFailConnectionFailed(bool $fail_connection_failed = true) : void
    {
        $this->is_connected = false;
        $this->fail_connection_failed = $fail_connection_failed;
    }
1032236
public function fails() {
      $ban = false;
      if (count(@$this->fails["failed"]) > 0 || count(@$this->fails["messages"]) > 0) {
         $ban = true;
      }
      return $ban;
   }
109101
public function check($data = null, &$failed = null) {
        // reset var if it is defined
        $failed = null;

        $valid = $this->checkType($data, $failed) && $this->checkValueSet($data, $failed);

        if (!$valid) Structure::$lastFail = $failed;
        return $valid;
    }
290701
def _connection_failed(self, link_uri, msg):
        """"""
        print('Connection to %s failed: %s' % (link_uri, msg))
        self.is_connected = False
92718
final public static function setError (string $errorMessage=NULL) : bool
	{
		static::$error = "";
		if (!static::hasValue($errorMessage)) return FALSE;
		static::$error = "Check the following field(s) ".stripComma($errorMessage)." and try again.";
		return TRUE;
	}
696256
protected function _fail( $message, $result = false)
    {
        // @todo Investigate the right function
        if ( $result !== false )
        {
            $message .= "\n" . pg_result_error( $result, PGSQL_DIAG_SQLSTATE ) . ": " . pg_result_error( $result, PGSQL_DIAG_MESSAGE_PRIMARY );
        }
        else
        {
            $errorInfo = $this->db->errorInfo();
            $message .= "\n$errorInfo[2]";
        }
        throw new Exception( $message );
    }
677897
public function setFailOn($failOn)
    {
        $this->_failOn = [];
        $token         = ' ,;';
        $fail          = strtok($failOn, $token);

        while ($fail !== false) {
            $this->_failOn[] = $fail;
            $fail            = strtok($token);
        }

    }
1281596
public function log_login($user = null, $failed_login = false, $error_code = 0)
    {
        if (!$this->config->get('log_logins')) {
            return;
        }

        // failed login
        if ($failed_login) {
            // don't fill the log with complete input, which could
            // have been prepared by a hacker
            if (strlen($user) > 256) {
                $user = substr($user, 0, 256) . '...';
            }

            $message = sprintf('Failed login for %s from %s in session %s (error: %d)',
                $user, rcube_utils::remote_ip(), session_id(), $error_code);
        }
        // successful login
        else {
            $user_name = $this->get_user_name();
            $user_id   = $this->get_user_id();

            if (!$user_id) {
                return;
            }

            $message = sprintf('Successful login for %s (ID: %d) from %s in session %s',
                $user_name, $user_id, rcube_utils::remote_ip(), session_id());
        }

        // log login
        self::write_log('userlogins', $message);
    }
1088620
def fail(self, message, status=500, **kw):
        
        self.request.response.setStatus(status)
        result = {"success": False, "errors": message, "status": status}
        result.update(kw)
        return result
392262
protected void handleConfigureRequestFailure(MemberState member, ConfigureRequest request, Throwable error) {
    // Log the failed attempt to contact the member.
    failAttempt(member, error);
  }
1006288
protected function fail()
    {
        $this->success = false;

        if ($this->shouldRedirect) {
            die(Response::redirect(Url::last()));
        } else {
            $this->shouldFallThrough = true;
        }
    }
1074127
public function setCustomErrorLevel($issue_key, $error_level)
    {
        $this->issue_handlers[$issue_key] = new IssueHandler();
        $this->issue_handlers[$issue_key]->setErrorLevel($error_level);
    }
410151
private function checkFailure() : void
    {
        $failure = (int) $this->session->get('failure', 0);
        $time    = (int) $this->session->get('failure_time', time());
        if ($failure >= static::FAILURE) {
            if ($time >= time()) {
                throw new \DomainException($this->i18n->t(
                    'setrun/user',
                    'Form is blocked for {min} minutes',
                    ['min' => static::FAILURE_TIME / 60])
                );
            }
            $this->removeFailure();
        }
    }
1089718
void set_value() throws DevFailed
	{
		switch(data_type)
		{
		case Tango_DEV_BOOLEAN:
			super.set_value(bool_val);
			break;
		
		case Tango_DEV_SHORT:
			super.set_value(short_val);
			break;
		
		case Tango_DEV_LONG:
			super.set_value(long_val);
			break;
				
		case Tango_DEV_LONG64:
			super.set_value(long64_val);
			break;
				
		case Tango_DEV_DOUBLE:
			super.set_value(double_val);
			break;
		
		case Tango_DEV_STRING:
			super.set_value(str_val);
			break;
		}
	}
735075
public static function checkConnections($connection_name, $table, $check)
    {
        if($check === true)
        {
            $connections = DB::connection($connection_name)->table($table)->get();

            foreach($connections as $connection)
            {
                $name = $connection->name;

                try{
                    $testConnection = DB::connection($name)->getPdo();
                }catch(\Exception $e)
                {
                    $error = $e->getMessage();
                    \error_log($error);
                }
                if(!empty($testConnection) && empty($error))
                {
                    $update = DB::connection($connection_name)->table($table)->where('name', $name)->update(['status' => true]);
                }
                else
                {
                    $update = DB::connection($connection_name)->table($table)->where('name', $name)->update(['status' => false]);
                }
            }
        }
    }
240537
protected function fail($error = '')
    {
        $this->isFinished = true;
        $this->isSuccess = false;
        $this->error = $error;
    }
123221
public function fail()
    {
        $args = func_get_args();
        $str = ucfirst(
            $this->prefix.
            ($this->caption ?: str_replace('_', ' ', $this->active_field)).' '.
            lcfirst(array_shift($args))
        );

        // Insert any args into placeholders
        if (count($args) > 0) {
            $n = 1;

            foreach ($args as $arg) {
                $tag = sprintf('{{arg%s}}', $n);
                $str = str_replace($tag, $arg, $str);
                ++$n;
            }
        }

        /** @type Exception_ValidityCheck $e */
        $e = $this->exception((string) ($this->custom_error ?: $str));
        throw $e->setField($this->active_field);
    }