Exception: ActiveRecord::DatabaseConnectionError

Inherits:
ConnectionNotEstablished show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/errors.rb

Overview

Raised when connection to the database could not been established because it was not able to connect to the host or when the authorization failed.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil) ⇒ DatabaseConnectionError

Returns a new instance of DatabaseConnectionError.



69
70
71
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/errors.rb', line 69

def initialize(message = nil)
  super(message || "Database connection error")
end

Class Method Details

.hostname_error(hostname) ⇒ Object



74
75
76
77
78
79
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/errors.rb', line 74

def hostname_error(hostname)
  DatabaseConnectionError.new(<<~MSG)
    There is an issue connecting with your hostname: #{hostname}.\n
    Please check your database configuration and ensure there is a valid connection to your database.
  MSG
end

.username_error(username) ⇒ Object



81
82
83
84
85
86
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activerecord-7.0.4/lib/active_record/errors.rb', line 81

def username_error(username)
  DatabaseConnectionError.new(<<~MSG)
    There is an issue connecting to your database with your username/password, username: #{username}.\n
    Please check your database configuration to ensure the username/password are valid.
  MSG
end