Re: Trapping Concurrent.Future failures

Chris Angelico <[email protected]> Fri, 2 Aug 2019 19:36:08 +1000
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAPTjJmqHfyNaJ+KHqNn_ZcPcL2mcmpxw-whO-ckq=oJz4bY4HA@mail.gmail.com>
On Fri, Aug 2, 2019 at 7:30 PM Stephen R. van den Berg <[email protected]> wrote:
>
> Chris Angelico wrote:
> >I'm currently converting some parts of a project from using myriad
> >callbacks to returning a Concurrent.Future. One of the downsides is
> >that unexpected errors are now being silenced; the Future is failing,
> >but that doesn't do anything. Is there a way to set some sort of
> >global callback to be triggered any time a Future failure is left
> >unhandled?
>
> //! Global failure callback, called when a promise without failure
> //! callback fails. This is useful to log exceptions, so they are not
> //! just silently caught and ignored.
> Concurrent.on_failure(function(mixed : void) f);
>
> Should do it.

Ah! That hasn't managed to come through in the online documentation
(neither the version I have locally built, nor the one on the main
site). But it's exactly what I was looking for! Thanks!

I can't see why it wouldn't have been picked up in the docs, either. Curious.

ChrisA