On Dec 26, 2012, at 11:02 PM, Jens Alfke <[email protected]> wrote:

> Agreed. This seems to me to be an endemic problem of Erlang programs — the 
> pattern-matching behavior in the language is extremely convenient but results 
> in software that handles any sort of incorrect input with a generic exception 
> like “badmatch”. Which might be okay if the software took care to catch all 
> of those exceptions and map them into either app-specific exceptions or some 
> kind of error codes; but none of the Erlang code I’ve seen (mostly just 
> CouchDB) ever does that. One of the few pieces of Erlang code I wrote did 
> carefully try to catch such generic exceptions, but I was told by the 
> reviewer that it was “not idiomatic”.
> 
> Someone should totally fix this particular bug. But in my experience there 
> are dozens of other similar ones in the CouchDB code. Coding in Erlang seems 
> to breed these bugs, the same way that coding in C breeds memory smashers.
> 
> Yes, I am a little bitter about this. CouchDB has the most absurdly 
> verbose-but-incomprehensible log messages. I have spent/wasted many hours 
> trying to make sense of them.

It'd be great to devote some concerted effort next year to ensuring that all 
manner of bad input results in a 4xx code and a sensible response body instead 
of a 5xx and a completely raw stack trace.  I think we'd stumble upon an 
"idiomatic" solution in the end.

Adam

Reply via email to