# Real-World Event Sourcing: \`handle\_command\` for subtract doesn't make sense (pg 8)

**URL:** <https://forum.devtalk.com/t/real-world-event-sourcing-handle-command-for-subtract-doesnt-make-sense-pg-8/192921>\
**Category:** PragProg Customers\
**Tags:** book-real-world-event-sourcing, errata\
**Created:** [28 March 2025 08:02 UTC](https://forum.devtalk.com/t/real-world-event-sourcing-handle-command-for-subtract-doesnt-make-sense-pg-8/192921 "2025-03-28T08:02:56Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![dmitrykleymenov](https://forum.devtalk.com/user_avatar/forum.devtalk.com/dmitrykleymenov/32/2816_2.png) [@dmitrykleymenov](https://forum.devtalk.com/u/dmitrykleymenov)\
**Post date:** [6 June 2025 09:58 UTC](https://forum.devtalk.com/t/real-world-event-sourcing-handle-command-for-subtract-doesnt-make-sense-pg-8/192921/2 "2025-06-06T09:58:20Z")

</div>

I’ve found the same issue, but think the code should be like:

```auto
  def handle_command(%{value: val}, %{cmd: :sub, value: v}) do
    %{event_type: :value_subtracted, value: min(val - @min_state_value, v)}
  end

```

In this case we can use `@min_state_value` correctly(not only 0)

---

_[View the full topic](https://forum.devtalk.com/t/real-world-event-sourcing-handle-command-for-subtract-doesnt-make-sense-pg-8/192921)._
