Exception: TranslatorText::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/translator_text/exceptions.rb

Direct Known Subclasses

NetError, ServiceError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, message:) ⇒ Error

Returns a new instance of Error.



5
6
7
8
# File 'lib/translator_text/exceptions.rb', line 5

def initialize(code:, message:)
  @code = code
  @message = message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/translator_text/exceptions.rb', line 3

def code
  @code
end

#errorsObject (readonly)

Returns the value of attribute errors.



3
4
5
# File 'lib/translator_text/exceptions.rb', line 3

def errors
  @errors
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/translator_text/exceptions.rb', line 3

def message
  @message
end

Instance Method Details

#to_sObject



10
11
12
# File 'lib/translator_text/exceptions.rb', line 10

def to_s
  "#{message} (#{code})"
end