Class Clickatell::API::Error
In: lib/clickatell/api/error.rb
Parent: StandardError

Clickatell API Error exception.

Methods

new   parse  

Attributes

code  [R] 
message  [R] 

Public Class methods

[Source]

# File lib/clickatell/api/error.rb, line 8
      def initialize(code, message)
        @code, @message = code, message
      end

Creates a new Error from a Clickatell HTTP response string e.g.:

 Error.parse("ERR: 001, Authentication error")
 # =>  #<Clickatell::API::Error code='001' message='Authentication error'>

[Source]

# File lib/clickatell/api/error.rb, line 17
      def self.parse(error_string)
        error_details = error_string.split(':').last.strip
        code, message = error_details.split(',').map { |s| s.strip }
        self.new(code, message)
      end

[Validate]