Class: ViewModel::ErrorView::ExceptionDetailView

Inherits:
ViewModel
  • Object
show all
Defined in:
lib/view_model/error_view.rb

Constant Summary

Constants inherited from ViewModel

ID_ATTRIBUTE, NEW_ATTRIBUTE, REFERENCE_ATTRIBUTE, TYPE_ATTRIBUTE, VERSION_ATTRIBUTE

Instance Method Summary collapse

Methods inherited from ViewModel

#==, accepts_schema_version?, add_view_alias, attribute, attributes, #blame_reference, #context_for_child, deserialize_context_class, deserialize_from_view, deserialize_members_from_view, eager_includes, encode_json, extract_reference_metadata, extract_reference_only_metadata, extract_viewmodel_metadata, #hash, #id, inherited, #initialize, initialize_as_viewmodel, is_update_hash?, lock_attribute_inheritance, member_names, #model, new_deserialize_context, new_serialize_context, #preload_for_serialization, preload_for_serialization, root!, root?, serialize, #serialize, serialize_as_reference, serialize_context_class, serialize_to_hash, #stable_id?, #to_hash, #to_json, #to_reference, #validate!, #view_name

Constructor Details

This class inherits a constructor from ViewModel

Instance Method Details

#serialize_view(json, serialize_context: nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/view_model/error_view.rb', line 10

def serialize_view(json, serialize_context: nil)
  json.set! :class, exception.class.name
  json.backtrace exception.backtrace
  if cause = exception.cause
    json.cause do
      json.set! :class, cause.class.name
      json.backtrace cause.backtrace
    end
  end
end