Exception: GitHubPages::HealthCheck::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/github-pages-health-check/error.rb

Constant Summary collapse

DOCUMENTATION_BASE =
"https://help.github.com"
DOCUMENTATION_PATH =
"/categories/github-pages-basics/"
LOCAL_ONLY =

Error is only used when running locally

false

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository: nil, domain: nil) ⇒ Error

Returns a new instance of Error.



10
11
12
13
14
# File 'lib/github-pages-health-check/error.rb', line 10

def initialize(repository: nil, domain: nil)
  super
  @repository = repository
  @domain     = domain
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



8
9
10
# File 'lib/github-pages-health-check/error.rb', line 8

def domain
  @domain
end

#repositoryObject (readonly)

Returns the value of attribute repository.



8
9
10
# File 'lib/github-pages-health-check/error.rb', line 8

def repository
  @repository
end

Class Method Details

.inherited(base) ⇒ Object



16
17
18
# File 'lib/github-pages-health-check/error.rb', line 16

def self.inherited(base)
  subclasses << base
end

.subclassesObject



20
21
22
# File 'lib/github-pages-health-check/error.rb', line 20

def self.subclasses
  @subclasses ||= []
end

Instance Method Details

#messageObject



24
25
26
# File 'lib/github-pages-health-check/error.rb', line 24

def message
  "Something's wrong with your GitHub Pages site."
end

#message_with_urlObject Also known as: message_formatted

Error message, with get more info URL appended



29
30
31
32
33
# File 'lib/github-pages-health-check/error.rb', line 29

def message_with_url
  msg = message.gsub(/\s+/, " ").squeeze(" ").strip
  msg << "." unless msg =~ /\.$/ #add trailing period if not there
  "#{msg} #{more_info}"
end

#to_sObject



36
37
38
# File 'lib/github-pages-health-check/error.rb', line 36

def to_s
  "#{message_with_url} (#{self.class.name.split('::').last})".gsub("\n", " ").squeeze(" ").strip
end