Proper exception handling
The practice of handling errors and exceptions is part of clean and efficient coding. This technique is added in development to make our code more readable and maintainable. But more often than not, a bug arises in code due to improper error handling. This statement is also true not just with ordinary bugs. but with security bugs too. Mishandled exceptions occur because of the incorrect ways of catching these anomalies, which induces unwanted exploitation.
In this recipe, we will fix the improper handling of exceptions and prevent our sample Online Banking web app from swallowing exceptions.
Getting ready
Using Visual Studio Code, open the sample Online Banking app folder at \Chapter13\exception-handling\before\OnlineBankingApp\
.
How to do it…
Let's take a look at the steps for this recipe:
- From the starting exercise folder, launch Visual Studio Code by typing the following command:
code .
- Open
Services\KnowledgebaseService...