class Git::CommandLineError::TimeoutError::VersionError
Raised when the installed git version does not meet requirements
This error is raised when:
-
The installed git version is below ‘Git::MINIMUM_GIT_VERSION`
-
A command requires a minimum git version that isn’t met
-
A command was removed in a git version older than the installed version
@example Rescuing a version error
begin git.some_command rescue Git::VersionError => e puts "Git version #{e.actual_version} does not meet requirements" puts " #{e.subject}: requires #{e.constraint}" end
@api public
Attributes
The installed git version that caused the error
@return [Git::Version]
The version constraint that was violated
@return [Git::VersionConstraint]
The entity that has the version requirement
@return [#to_s]
Public Class Methods
Source
# File lib/git/errors.rb, line 246 def initialize(subject:, constraint:, actual_version:) @subject = subject @constraint = constraint @actual_version = actual_version super(build_message) end
Create a VersionError
@param subject [#to_s] the entity with the version requirement (e.g., “The git gem”, a Class)
@param constraint [Git::VersionConstraint] the version constraint that was violated
@param actual_version [Git::Version] the installed git version
Private Instance Methods
Source
# File lib/git/errors.rb, line 277 def build_message if constraint.too_new?(actual_version) "#{subject} requires git < #{constraint.before} (found #{actual_version})" else "#{subject} requires git >= #{constraint.min} (found #{actual_version})" end end
Builds the error message for the violated version constraint.
@return [String]