Exception: Pdfcrowd::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Pdfcrowd::Error
- Defined in:
- lib/pdfcrowd.rb
Overview
Thrown when an error occurs.
Instance Attribute Summary collapse
-
#doc_link ⇒ Object
readonly
Returns the value of attribute doc_link.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#reason_code ⇒ Object
readonly
Returns the value of attribute reason_code.
Instance Method Summary collapse
- #getCode ⇒ Object
- #getDocumentationLink ⇒ Object
- #getMessage ⇒ Object
- #getReasonCode ⇒ Object
- #getStatusCode ⇒ Object
-
#initialize(error, http_code = nil) ⇒ Error
constructor
A new instance of Error.
- #to_s ⇒ Object
Constructor Details
#initialize(error, http_code = nil) ⇒ Error
Returns a new instance of Error.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/pdfcrowd.rb', line 49 def initialize(error, http_code=nil) super() @error = error error_match = @error.match(/^(\d+)\.(\d+)\s+-\s+(.*?)(?:\s+Documentation link:\s+(.*))?$/) || @error.scan(/^(\d+)\.(\d+)\s+-\s+(.*?)(?:\s+Documentation link:\s+(.*))?$/m) if error_match and error_match != [] @http_code = error_match[1] @reason_code = error_match[2] @message = error_match[3] @doc_link = error_match[4] || '' else @http_code = http_code @reason_code = -1 @message = @error if @http_code @error = "#{@http_code} - #{@error}" end @doc_link = '' end end |
Instance Attribute Details
#doc_link ⇒ Object (readonly)
Returns the value of attribute doc_link.
47 48 49 |
# File 'lib/pdfcrowd.rb', line 47 def doc_link @doc_link end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
47 48 49 |
# File 'lib/pdfcrowd.rb', line 47 def error @error end |
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
47 48 49 |
# File 'lib/pdfcrowd.rb', line 47 def http_code @http_code end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
47 48 49 |
# File 'lib/pdfcrowd.rb', line 47 def @message end |
#reason_code ⇒ Object (readonly)
Returns the value of attribute reason_code.
47 48 49 |
# File 'lib/pdfcrowd.rb', line 47 def reason_code @reason_code end |
Instance Method Details
#getCode ⇒ Object
74 75 76 77 |
# File 'lib/pdfcrowd.rb', line 74 def getCode() warn "[DEPRECATION] `getCode` is obsolete and will be removed in future versions. Use `getStatusCode` instead." @http_code end |
#getDocumentationLink ⇒ Object
91 92 93 |
# File 'lib/pdfcrowd.rb', line 91 def getDocumentationLink() @doc_link end |
#getMessage ⇒ Object
87 88 89 |
# File 'lib/pdfcrowd.rb', line 87 def getMessage() @message end |
#getReasonCode ⇒ Object
83 84 85 |
# File 'lib/pdfcrowd.rb', line 83 def getReasonCode() @reason_code end |
#getStatusCode ⇒ Object
79 80 81 |
# File 'lib/pdfcrowd.rb', line 79 def getStatusCode() @http_code end |
#to_s ⇒ Object
70 71 72 |
# File 'lib/pdfcrowd.rb', line 70 def to_s() @error end |