title: Event sourcing - error handling when events are not created
body: <p>As to my understanding, in event sourcing, events are recorded. However that would also mean a state changed first happened and thereafter we record the event. For example, assuming:</p>
  
  <ol>
  <li>A Client sends a command to a server to "Create user".</li>
  <li>The server validates the command and creates user i.e. stores new
  user in a database.</li>
  <li>The server then logs/stores a <code>Created User</code> event. i.e event
  sourcing.</li>
  <li><code>Created User</code> event is propagated to subscribers</li>
  </ol>
  
  <p>In the scenario above, how do we handle scenarios where step (2) succeeded but step (3) failed due to say network failures, database offline etc? The whole system would be in an indeterminate state now that there was a new user created but the event was never logged. How do we mitigate these types of failures? Or are the steps that I've listed above not the way to do event sourcing?</p>
  
  <p>Thanks!</p>