class Gruf::Serializers::Errors::Base

Base class for serialization of errors for transport across the grpc protocol

Attributes

error[R]

@return [Gruf::Error|String] The error being serialized

Public Class Methods

new(err) click to toggle source

@param [Gruf::Error|String] err The error to serialize

# File lib/gruf/serializers/errors/base.rb, line 31
def initialize(err)
  @error = err
end

Public Instance Methods

deserialize() click to toggle source

Must be implemented in a derived class. This method should deserialize the error object that is transported over the gRPC trailing metadata payload.

@return [Object|Hash] The deserialized error object

# File lib/gruf/serializers/errors/base.rb, line 51
def deserialize
  raise NotImplementedError
end
serialize() click to toggle source

Must be implemented in a derived class. This method should serialize the error into a transportable String that can be pushed into GRPC metadata across the wire.

@return [String] The serialized error

# File lib/gruf/serializers/errors/base.rb, line 41
def serialize
  raise NotImplementedError
end