Oliver Rutishauser

Greenhorn
+ Follow
since Feb 04, 2019
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Oliver Rutishauser

I have restarted my application, so the actual output is lost. But the whole story is the following. I use a library to access a web service. The application worked fine, so I left it running for the weekend. On Monday I have discovered that something was temporary wrong with the network, and the library failed to resolve the host name for a couple of times. The error caused the stack trace to dump. I decided that this error is essential for my application and I need to handle the exception gracefully. To my surprise, when I added an appropriate catch block, the compiler refused to compile my application. I believe that I am the boss here, and I am to decide which exceptions should be handled and which should not. I do not want to handle all the unchecked exceptions.  
My workaround is different. It is quite obvious that the compile is wrong. (Otherwise this question hasn't been asked here.) So to make it work the way I want it to work, I have created the following function.

and call it from the corresponding try block. Now the compiler is happy.