---
title: "Comment by Capi Etheriel on \"Away from exceptions: errors as values\" | Hashnode"
description: "That is hardly a fair example of error composition. For starters, Number.parseInt should throw or be replaced with a throwing parseInt function (hiding the deta"
url: "https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813/comment/612cd67a2858872661b9db25"
---

[Discussion](https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813)

Comment [Away from exceptions: errors as values](https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813)

[Capi Etheriel](https://hashnode.com/@barraponto)

[Aug 30, 2021](https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813/comment/612cd67a2858872661b9db25)

That is hardly a fair example of error composition.

For starters, `Number.parseInt` should throw or be replaced with a throwing `parseInt` function (hiding the details).

As for the `value > 3`, we should not treat an error we raised ourselves! We should either have the caller deal with it or not throw at all: just use `Math.min` and be done with it.

[Barisere Jonathan](https://hashnode.com/@barisere)

[Aug 30, 2021](https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813/comment/612cd67a2858872661b9db25#reply-612cdc652858872661b9dc3e)

That's correct. I'll rework the example later today. Thanks for pointing that out.

[Barisere Jonathan](https://hashnode.com/@barisere)

[Aug 30, 2021](https://hashnode.com/posts/away-from-exceptions-errors-as-values/612a159dfd0bf8636d76b813/comment/612cd67a2858872661b9db25#reply-612d2c6b2858872661b9e883)

I've updated the article with a modified example. I hope this works better.
