class Surveymonkey::Error
Constants
- Status_codes
API status codes, documented upstream.
Attributes
errmsg[R]
status[R]
status_codes[R]
status_name[R]
Public Class Methods
new(error = {}, status_codes = Status_codes)
click to toggle source
Create a new Surveymonkey::Error
object. Pass in the hash parsed from the JSON object returned by the API.
# File lib/surveymonkey/error.rb, line 24 def initialize(error = {}, status_codes = Status_codes) begin @status_codes = status_codes @status = error.fetch('status', 0) @errmsg = error.fetch('errmsg', '') @status_name = _status_name(@status) rescue StandardError => e $log.error(sprintf("%s: unable to parse '%s' as error", __method__, error.inspect)) raise e end end
Public Instance Methods
to_s()
click to toggle source
Stringify a Surveymonkey::Error
object.
# File lib/surveymonkey/error.rb, line 40 def to_s sprintf("Error %i (%s): %s", self.status, self.status_name, self.errmsg) end