pukkamustard schreef op wo 02-02-2022 om 10:28 [+0000]: > > pukkamustard schreef op di 25-01-2022 om 19:21 [+0000]: > > > +(define (ipfs-daemon-alive?) > > > +  "Attempt to connect to the IPFS daemon. Returns #t if the > > > daemon is alive > > > +and #f else." > > > +  (with-exception-handler > > > +      (const #f) > > > +    (lambda _ > > > +      (let ((response _ > > > +                      (http-post (string-append (%ipfs-base-url) > > > +                                                > > > "/api/v0/version")))) > > > +        (equal? 200 (response-code response)))) > > > +    #:unwind? #t)) > > > > This should preferably only be catching exceptions indicating that > > the daemon is down (exceptions indicating 404s, or system-errors > > indicating network errors, ...). > > Yes, I guess it could be checked a bit finer. But at the end if an > exception happens then the IPFS daemon is probably not reachable, > right? > If we don't care about the reason why it is not reachable then why > bother with catching finer grained exceptions? The exception could be caused by, say: * an unbound variable * wrong arity * type error * stack overflow * prompt tag does not exist in current environment * out of memory Except for the last one, these causes are all bugs and hence shouldn't be surpressed. Granted, this is a bit unlikely since this use of 'http-post' is very simple, but it's far from impossible for (web client) to have a bug. Greetings, Maxime.