-1
You have two chances to catch these mistakes (both can be used at the same time):
try
{
// Code
}
catch (Exception ex)
{
// Handle ex
}
Or you use the native middleware for handling exceptions of the . NET Core, which can be configured using the method UseExceptionHandler
. The Boilerplate of this code is already generated when we create a project so you can take a look at this code and adapt to your needs.
Hello Thais, do not post pictures of your problem, give preference to put in question, formatted, the point of code where the problem occurs.
– Pedro Paulo
Instead of letting the error happen, it might be a good thing to validate if the user no longer has a registered company.
– Barbetta