No disrespect, but this seems quite redundant to me.
Wouldn't it be better to have a global error(exception) logging in application in case as this? Catching any kind of exception, logging and returning a default value looks like a code smell to me. I always follow the rule that it's better to catch only those exceptions you would expect.
ASP.NET Core implements global exception lagging out of the box.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
No disrespect, but this seems quite redundant to me.
Wouldn't it be better to have a global error(exception) logging in application in case as this? Catching any kind of exception, logging and returning a default value looks like a code smell to me. I always follow the rule that it's better to catch only those exceptions you would expect.
ASP.NET Core implements global exception lagging out of the box.