Class: Paquito::TranslateErrors

Inherits:
Object
  • Object
show all
Defined in:
lib/paquito/translate_errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(coder) ⇒ TranslateErrors

Returns a new instance of TranslateErrors.



5
6
7
# File 'lib/paquito/translate_errors.rb', line 5

def initialize(coder)
  @coder = Paquito.cast(coder)
end

Instance Method Details

#dump(object) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/paquito/translate_errors.rb', line 9

def dump(object)
  @coder.dump(object)
rescue Paquito::Error
  raise
rescue => error
  raise PackError, error.message
end

#load(payload) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/paquito/translate_errors.rb', line 17

def load(payload)
  @coder.load(payload)
rescue Paquito::Error
  raise
rescue => error
  raise UnpackError, error.message
end