W3cubDocs

/Ruby on Rails 7.0

class ActiveRecord::DatabaseConnectionError

Parent:
ActiveRecord::ConnectionNotEstablished

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.

Public Class Methods

hostname_error(hostname) Show source
# File activerecord/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
new(message = nil) Show source
# File activerecord/lib/active_record/errors.rb, line 69
def initialize(message = nil)
  super(message || "Database connection error")
end
Calls superclass method
username_error(username) Show source
# File activerecord/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

© 2004–2021 David Heinemeier Hansson
Licensed under the MIT License.