Exception: Y::Translate::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Y::Translate::Error
- Defined in:
- lib/y/translate/error.rb
Constant Summary collapse
- ERROR_CODES =
{ default: 'Неизвестная ошибка запроса', 401 => 'Неправильный API-ключ', 402 => 'API-ключ заблокирован', 404 => 'Превышено суточное ограничение на объем переведенного текста', 413 => 'Превышен максимально допустимый размер текста', 422 => 'Текст не может быть переведен', 501 => 'Заданное направление перевода не поддерживается' }.freeze
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(code = :default) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(code = :default) ⇒ Error
Returns a new instance of Error.
16 17 18 19 20 |
# File 'lib/y/translate/error.rb', line 16 def initialize(code = :default) @code = code msg = ERROR_CODES[code] super(msg) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
14 15 16 |
# File 'lib/y/translate/error.rb', line 14 def code @code end |