Method: Pdfcrowd::Error#initialize
- Defined in:
- lib/pdfcrowd.rb
#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] = error_match[3] @doc_link = error_match[4] || '' else @http_code = http_code @reason_code = -1 = @error if @http_code @error = "#{@http_code} - #{@error}" end @doc_link = '' end end |