envato / event_sourcery

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

Improve event processing error #178

Closed twe4ked closed 7 years ago

twe4ked commented 7 years ago

It can be difficult to tell where failures are coming from in some cases. This change makes it clear by including the processor name and event content.

Example of the improved error:

Failures:

  1) item GET /item/:item_id with events returns an item
     Got 0 failures and 2 other errors:

     1.1) Failure/Error: processor.process(event)

          EventSourcery::EventProcessingError:
            #<Shoebox::Queries::Item::Projector @@processor_name=:item>
            #<EventSourcery::Event @id=86, @uuid="11950d74-ae2d-4df7-833c-e9372d7675a1", @type="asset_provided">
            #<RuntimeError: the roof>
          # /Users/odin/Dev/github/event_sourcery/event_sourcery/lib/event_sourcery/event_processing/event_stream_processor.rb:43:in `rescue in process'
          # /Users/odin/Dev/github/event_sourcery/event_sourcery/lib/event_sourcery/event_processing/event_stream_processor.rb:28:in `process'
          # ./spec/support/publish_event_helpers.rb:20:in `block (2 levels) in process_events_with_processors'
twe4ked commented 7 years ago

I've pushed a few more commits @jiexinhuang @stevehodgkiss @Domon