envato / event_sourcery

A library for building event sourced applications in Ruby
MIT License
84 stars 10 forks source link

Suggest changing the error passed to `on_event_processor_error` callback #219

Open Vuta opened 4 years ago

Vuta commented 4 years ago

Context

Currently we can configure the event processors errors monitor using config.on_event_processor_error.

 config.on_event_processor_error = proc { |exception, processor_name| … }

The callback accepts the exception which just contains the error cause instead of an instance of EventSourcery::EventProcessingError, please see: https://github.com/envato/event_sourcery/blob/master/lib/event_sourcery/event_processing/error_handlers/error_handler.rb#L18

But IMHO, the context of the error (the event where the error happened) is more important. I'm not sure if you guys have different thoughts in mind but I propose that we pass the whole error to the callback instead of the error cause.

I can add a PR to address this if you guys want to proceed with it