Class: Gruf::Serializers::Errors::Base
- Inherits:
-
Object
- Object
- Gruf::Serializers::Errors::Base
- Defined in:
- lib/gruf/serializers/errors/base.rb
Overview
Base class for serialization of errors for transport across the grpc protocol
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error ⇒ Gruf::Error|String
readonly
The error being serialized.
Instance Method Summary collapse
-
#deserialize ⇒ Object|Hash
Must be implemented in a derived class.
-
#initialize(err) ⇒ Base
constructor
A new instance of Base.
-
#serialize ⇒ String
Must be implemented in a derived class.
Constructor Details
#initialize(err) ⇒ Base
Returns a new instance of Base.
29 30 31 |
# File 'lib/gruf/serializers/errors/base.rb', line 29 def initialize(err) @error = err end |
Instance Attribute Details
#error ⇒ Gruf::Error|String (readonly)
Returns The error being serialized.
24 25 26 |
# File 'lib/gruf/serializers/errors/base.rb', line 24 def error @error end |
Instance Method Details
#deserialize ⇒ Object|Hash
Must be implemented in a derived class. This method should deserialize the error object that is transported over the gRPC trailing metadata payload.
49 50 51 |
# File 'lib/gruf/serializers/errors/base.rb', line 49 def deserialize raise NotImplementedError end |
#serialize ⇒ String
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.
39 40 41 |
# File 'lib/gruf/serializers/errors/base.rb', line 39 def serialize raise NotImplementedError end |