Hi!

I've been playing with error-kit, and like a ranting guy on the street
I'd like to share random thoughts...

* I'll probably come to rely on error-kit, or something like it.

Suppose you're playing with nakkaya's distributed computing thingie ¹;
you could hook simple listeners to do stuff when a server's slow or
didn't respond:
* just return nil
* keep performance statistics, have an excuse to learn Incanter
* redeploy tasks to faster servers
* SMS you


* "Argmaps" are a nice technique, but too easy to make scary bugs?

Last night it took me forever to figure out what was going wrong.
Turns out my argument list in deferror has to match the argument lists
of my handlers/continues. Otherwise silent failures happen, easily
fooling me into a wrong mental model.


* When using fancy concurrency, new threads easily blow away your
handlers/continues. So they have to be reestablished ².

  (deferror my-error [] []
    {:unhandled (constantly :unhandled)})

  (with-handler @(future (raise my-error :raised))
     (handle my-error []
       (continue-with :continued)))

  ;; :^(
  => :unhandled

  (with-handler
    (save-handlers
      @(future (reload-handlers (raise my-error :raised))))
    (handle my-error []
      (continue-with :continued)))
  ;; :^)
  => :continued

I suspect error-kit would need to be modified (as the handlers are
private), but my Clojure contributor snailmail has to go over an ocean
to reach Rich, and I only sent it yesterday... So I'm not sure I can
patch it yet...


All the best,
Tayssir

¹
http://nakkaya.com/2010/02/16/net-eval-dead-simple-distributed-computing-for-clojure/

²
In the example, I used a thin wrapper around:
http://github.com/tjg/tjg-utils/blob/37956e43bc82cd18072198ed79a529cd90c9bfe9/src/tjg-utils.clj#L78

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to