ruby-hyperloop / hyper-mesh

The project has moved to Hyperstack!! - Synchronization of active record models across multiple clients using Pusher, ActionCable, or Polling
https://hyperstack.org/
MIT License
22 stars 12 forks source link

add `ReactiveRecord.on_fetch_error` call back method #72

Open catmando opened 6 years ago

catmando commented 6 years ago

so that for debug, logging, etc purposes you can define it yourself.

module ReactiveRecord
  def self.on_fetch_error(e, params)
    # do whatever you need to
  end
end
catmando commented 6 years ago

so works as described above...

specifically params will look like this:

      'acting_user' => # current acting user,
      'controller' =>  # the controller the request came in on (so you can poke at session etc)
      'pending_fetches' => # i.e. the graph to fetch - note this is subject to change 
                                          [['TodoItem', ['find_by', { 'id' => 2 }], 'comments', '*count']],
      'models' => [], i.e. a list of models that have currently changed on the client
      'associations' => [], i.e. a list of related associations
janbiedermann commented 6 years ago

should be documented somewhere

sfcgeorge commented 6 years ago

Could I suggest not printing the controller param? It may be useful to have, but the error Hyperloop logs is now massive and hard to scroll up to find the actual error. Overriding full_message might do it.

I see several different error classes across the gems, e.g. Hyperloop::AccessViolation and ReactiveRecord::AccessViolation. It would be useful if they all shared a parent class e.g. HyperloopError rather than inheriting from StandardError.

catmando commented 6 years ago

@sfcgeorge I cannot reproduce having the controller dumped anywhere. Can you show me how to reproduce?

sfcgeorge commented 6 years ago

@catmando Looks like this in the Rails server log (note this goes on a loooong way further scrolling up):

screen shot 2018-03-06 at 15 22 30

When an execute_remote fails it looks like that for me now. This is when it was an exception rather than a validation error.

catmando commented 6 years ago

the above issue about the log has been closed in hyper-operation... thanks for the heads up @sfcgeorge