Class: EmailErrorReporter::ExceptionSerializer

Inherits:
ActiveJob::Serializers::ObjectSerializer
  • Object
show all
Defined in:
lib/email_error_reporter/exception_serializer.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(hash) ⇒ Object



11
12
13
14
15
# File 'lib/email_error_reporter/exception_serializer.rb', line 11

def deserialize(hash)
  hash[:exception_class].constantize.new(hash[:message]).tap do |e|
    e.set_backtrace(hash[:backtrace])
  end
end

#serialize(exception) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/email_error_reporter/exception_serializer.rb', line 3

def serialize(exception)
  super(
    exception_class: exception.class.to_s,
    message: exception.message,
    backtrace: exception.backtrace
  )
end