---
title: "Comment by Chang Soo Lim on \"Functional Domain Driven Design: Simplified\" | Hashnode"
description: "Thank you for an awesome article. I have a question about controller part. All switch case handle deriver outcome. Do you have any idea about how to handle erro"
url: "https://hashnode.com/posts/functional-domain-driven-design-simplified/626e8ef8d02237eb3fc7c5ac/comment/63fdca2fc72bc5248ac266f2"
---

[Discussion](https://hashnode.com/posts/functional-domain-driven-design-simplified/626e8ef8d02237eb3fc7c5ac)

Comment [Functional Domain Driven Design: Simplified](https://hashnode.com/posts/functional-domain-driven-design-simplified/626e8ef8d02237eb3fc7c5ac)

[Chang Soo Lim](https://hashnode.com/@llo)

[Feb 28, 2023](https://hashnode.com/posts/functional-domain-driven-design-simplified/626e8ef8d02237eb3fc7c5ac/comment/63fdca2fc72bc5248ac266f2)

Thank you for an awesome article. I have a question about controller part.

All switch case handle deriver outcome. Do you have any idea about how to handle errors such as getting data from db, sendRepaymentReminder and so on?

I followed this fDDD pattern in my toy project and was curious about this. Thanks again for this really nice article.

[Anthony Manning-Franklin](https://hashnode.com/@Antman261)

[Apr 23, 2023](https://hashnode.com/posts/functional-domain-driven-design-simplified/626e8ef8d02237eb3fc7c5ac/comment/63fdca2fc72bc5248ac266f2#reply-64449ba4ea9c083a86dcc4e9)

If the database throws an exception, then something is seriously wrong with your application and you want to fail fast and hard. Let the exception bubble all the way up to your route handler, return 500, and log the exception.

You need to differentiate between user error and system error. User error is an outcome you want to handle and include in your type system, while a system error is an exception you want to throw. I talk about this more in [antman-does-software.com/stop-catching-errors-in-…](https://antman-does-software.com/stop-catching-errors-in-typescript-use-the-either-type-to-make-your-code-predictable)

If you mean "what if the row doesn't exist" well that's easy, have your database repo return the Entity or undefined, and have the deriver return an appropriate outcome if the result of the lookup is undefined.
