In any case, [ ZnClient new get: 'http://host-does-not-exist-123123.com' ] on: NetworkError do: [ #myFailure ]
returns #myFailure and does not invoke the #defaultAction, nor any UI. Like I said, you can just catch the exception you want. > On 2 Sep 2020, at 22:15, Jimmie Houchin <jlhouc...@gmail.com> wrote: > > > On 9/2/20 2:36 PM, Sven Van Caekenberghe wrote: >> Hi Jimmie, >> >>> On 2 Sep 2020, at 20:29, Jimmie Houchin <jlhouc...@gmail.com> wrote: >>> >>> >>> Before I get to my problem. I want to thank Sven for the huge effort that >>> had to be made to provide all of the Zinc networking tools. Thank you. >> Thanks, you're welcome. >> >>> I am using ZnClient in an app. It is working fine. But I do not want any UI >>> Notifications. This will eventually be headless on a server. But right now >>> in development when the internet goes out I get a pop up from >>> NameLookupFailure which offers me the options of "Give Up" or "Retry". >>> >>> I need to suppress this popup. I already have Error handling code which >>> will catch NameLookupFailure among many other network based errors. >> I know this is confusing, but this is not a problem. You can simply catch >> the NameLookupFailure and this will work as expected. The problem is the >> custom/overwritten NameLookupFailure>>#defaultAction which is doing UI stuff >> (although this gets handled differently in a headless image as well). IMHO >> this should be removed. >> >> ZnClientTest>>#testIfFailNonExistingHost is an example that does more or >> less what you want. > > > Yes. In the current stack trace in the debugger it never reaches my Error > handling and hits the #defaultAction method. > > > Thanks. That puts me on the path I want to go. > > I probably need to learn to read the tests for or as documentation for code. > I am not currently in that habit. > > >>> Also, is there a better way to check if the network is up other than simply >>> making a request and either getting a successful response or an Error? >> This is not such an easy problem to solve. Doing something simple, like >> accessing a known host, is one way (but never 100% since that host might be >> down on itself). >> >> There is also the problem of timeouts (i.e. very slow networks). >> >> One of my experimental projects, https://github.com/svenvc/NeoDNS, does >> contains something called NeoNetworkState that tests internet connectivity >> by doing a DNS call. But this probably goes to far. >> >> HTH, > > Helps tremendously. Currently when I get a network error, I have a loop which > polls the least resource consuming URL on the server that I need to access. I > exit the loop upon a successful response and continue with my app's main > loop. I figure that lets me know that networking is back up and the server I > need is responding. Covers all my bases. I just wanted to know if I was > overlooking something that all you smart people who spend way more time than > I do on this stuff had a solution. I couldn't think of an easy generic > solution that could be created. > > Again thanks. > > >> >> Sven >> >>> Thanks for any help. >>> >>> >>> Jimmie