clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 106 forks source link

deferred: support data matching in catch' #181

Closed pyr closed 3 years ago

pyr commented 4 years ago

This patch introduces new error matching capabilities to d/catch' and thus d/catch, while presevering the original behavior.

The intent is to for the common use-case of matching on ex-data content to be possible with no modification.

pyr commented 4 years ago

The test failure seems due to lein jammin since test work fine otherwise. Before going down that rabbit-hole, I'd love comments on the validity of the approach.

KingMob commented 3 years ago

@pyr Thanks for the effort you put into this.

However, I think this function is a bit niche, and much of it could be accomplished via other means (e.g., catching an ExceptionInfo and then examining its ex-data in the error-handler). Also, this change would muddy the symmetry with standard Java catch behavior.

I'm closing for now, but I'm open to hearing further, especially if the :type key in ex-data is truly in widespread use. (I don't believe it is.)