Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
devios157016yI inherited a codebase that did a very similar thing. It wasn't quite as bad but what it was doing was catching all errors no matter what they were and turning them into generic 500 server errors with no message and nothing logged. So you could tell something was breaking, but you couldn't tell what or why.
-
asgs112786yIn my case, I had a logger info in catch saying "api call done" or similar. I blindly assumed it was a 2xx before we saw a mismatch in the log count.
At which point, we realized we had been duped -
mt3o19136yIt's not that bad, as it gets. There are scenarios where it can be right approach. First example is char array to string decoding, potentially throwing exception for invalid encoding.
Another example is having connection error handling in upper layers, or aspects, and logging handled in lower layers, or aspects. I do this quite often.
One more example - having default value assigned to variable and reading from configuration. You can have FileNotFoundException or NumberFormatException, which are moot. You just keep the defaults, there is no need to explicitly log the problem.
There is approach in which all logs must be handled, either by safe checks, or just changing the log level when it's acceptable. I'm a fan of this approach :) -
devios157016y@mt3o They're hardly moot if you want to give your users any kind of information as to why their config failed to load.
File not found is very different from illegal number formatting.
Relying on exceptions in non-exceptional scenarios is just bad form. Exceptions are not meant give you a lazy way to avoid properly handling error conditions.
Related Rants
-
DevTard16User:"It's not working" Me:"Have you turned it off and on again?" User:"Yes" Me: goes down there, system upti...
-
AdrianCookie18I think I'll never going to get a devRant stress ball, so i made this instead with my pretty low budget (0.5$)...
-
kwameboame5*yesterday* Client: "Perfect! How did you do this so quickly?" Me: "I used a library" *today* Me: "I'm still d...
App fails, Check logs...No error logged. Check source code and debug....
And then you see following piece of code....
try{
//Code to hit an API
}catch(Exception ex){
/*DO NOTHING. Not even log stack trace*/
}
rant
kms
facepalm
triggered