Exception: Pray::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Pray::Error
- Defined in:
- lib/pray/error.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
readonly
Returns the value of attribute category.
Class Method Summary collapse
- .integrity(message) ⇒ Object
- .io(error) ⇒ Object
- .manifest(message) ⇒ Object
- .parse(kind, message) ⇒ Object
- .render(message) ⇒ Object
- .resolution(message) ⇒ Object
- .unsupported(message) ⇒ Object
- .usage(message) ⇒ Object
- .verify(message) ⇒ Object
Instance Method Summary collapse
- #exit_code ⇒ Object
-
#initialize(category, message, parse_kind: nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(category, message, parse_kind: nil) ⇒ Error
Returns a new instance of Error.
5 6 7 8 9 |
# File 'lib/pray/error.rb', line 5 def initialize(category, , parse_kind: nil) @category = category @parse_kind = parse_kind super() end |
Instance Attribute Details
#category ⇒ Object (readonly)
Returns the value of attribute category.
11 12 13 |
# File 'lib/pray/error.rb', line 11 def category @category end |
Class Method Details
.integrity(message) ⇒ Object
48 |
# File 'lib/pray/error.rb', line 48 def self.integrity() = new(:integrity, ) |
.io(error) ⇒ Object
53 |
# File 'lib/pray/error.rb', line 53 def self.io(error) = new(:io, error.) |
.manifest(message) ⇒ Object
46 |
# File 'lib/pray/error.rb', line 46 def self.manifest() = new(:manifest, ) |
.parse(kind, message) ⇒ Object
42 43 44 |
# File 'lib/pray/error.rb', line 42 def self.parse(kind, ) new(:parse, , parse_kind: kind) end |
.render(message) ⇒ Object
49 |
# File 'lib/pray/error.rb', line 49 def self.render() = new(:render, ) |
.resolution(message) ⇒ Object
47 |
# File 'lib/pray/error.rb', line 47 def self.resolution() = new(:resolution, ) |
.unsupported(message) ⇒ Object
51 |
# File 'lib/pray/error.rb', line 51 def self.unsupported() = new(:unsupported, ) |
.usage(message) ⇒ Object
52 |
# File 'lib/pray/error.rb', line 52 def self.usage() = new(:usage, ) |
.verify(message) ⇒ Object
50 |
# File 'lib/pray/error.rb', line 50 def self.verify() = new(:verify, ) |
Instance Method Details
#exit_code ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pray/error.rb', line 13 def exit_code case category when :parse, :usage then 2 when :manifest, :io then 1 when :resolution then 3 when :integrity then 4 when :render then 5 when :verify then 6 when :unsupported then 8 else 1 end end |
#to_s ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pray/error.rb', line 26 def to_s prefix = case category when :parse then "#{@parse_kind} parse error" when :usage then "usage error" when :manifest then "manifest error" when :resolution then "resolution error" when :integrity then "integrity error" when :render then "render error" when :verify then "verify error" when :unsupported then "unsupported feature" when :io then "I/O error" else category.to_s end "#{prefix}: #{super}" end |