hyper-mesh icon indicating copy to clipboard operation
hyper-mesh copied to clipboard

add `ReactiveRecord.on_fetch_error` call back method

Open catmando opened this issue 7 years ago • 6 comments

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 avatar Mar 03 '18 21:03 catmando

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

catmando avatar Mar 04 '18 07:03 catmando

should be documented somewhere

janbiedermann avatar Mar 05 '18 04:03 janbiedermann

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.

sfcgeorge avatar Mar 05 '18 12:03 sfcgeorge

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

catmando avatar Mar 06 '18 15:03 catmando

@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.

sfcgeorge avatar Mar 06 '18 15:03 sfcgeorge

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

catmando avatar Mar 06 '18 21:03 catmando