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.

Methods

Class Public methods

hostname_error(hostname)

📝 Source code
# File activerecord/lib/active_record/errors.rb, line 91
      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
🔎 See on GitHub

new(message = nil)

📝 Source code
# File activerecord/lib/active_record/errors.rb, line 86
    def initialize(message = nil)
      super(message || "Database connection error")
    end
🔎 See on GitHub

username_error(username)

📝 Source code
# File activerecord/lib/active_record/errors.rb, line 98
      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
🔎 See on GitHub