Andre Lopes
1 min readOct 5, 2020

Thank you!

Every exception that it is not “controlled" will fall to the generic response before the check.

The response/exceptio handling can be tailored for your needs. For a more generic approach, you can create a generic controlled Exception, like an IControlledException, and make every custom exception you want to have a better response to your client inherit from it. The instead of a hardcoded check, you can check if the exceptio is of type IControlledException and refine your response there.

I also didn’t put in this article but you should log your exception before returning the response.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Written by Andre Lopes

Full-stack developer @ Tesla | Public Speaker | AWS | Terraform | Serverless | Gamer | Eternal Geek 🤓

No responses yet

Write a response