class THTP::SerializationError
Indicates a failure to turn a value into Thrift bytes according to schema
Public Class Methods
new(error)
click to toggle source
@param error [StandardError] the exception encountered while serialising
Calls superclass method
# File lib/thtp/errors.rb, line 65 def initialize(error) super friendly_message(error) end
type()
click to toggle source
# File lib/thtp/errors.rb, line 60 def self.type Thrift::ApplicationException::PROTOCOL_ERROR end
Private Instance Methods
friendly_message(error)
click to toggle source
# File lib/thtp/errors.rb, line 83 def friendly_message(error) "Serialization error (#{friendly_type(error)}): #{error.message}" end
friendly_type(error)
click to toggle source
# File lib/thtp/errors.rb, line 71 def friendly_type(error) return :other unless error.respond_to?(:type) { 1 => :invalid_data, 2 => :negative_size, 3 => :size_limit, 4 => :bad_version, 5 => :not_implemented, 6 => :depth_limit, }[error.type] || :unknown end