couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klaus Trainer (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COUCHDB-2050) don't throw errors in the core API modules like couch_db
Date Thu, 06 Feb 2014 10:52:09 GMT

    [ https://issues.apache.org/jira/browse/COUCHDB-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13893254#comment-13893254
] 

Klaus Trainer commented on COUCHDB-2050:
----------------------------------------

Good call.  I recently came across this and it hit me as pretty unintuitive (at least for
me as an Erlang programmer).  I was wondering about the stack trace you get when issuing a
GET request against a `/:db` endpoint, for instance.  Even though the stack trace is logged
on debug level only, I don't get why it's there in the first place.  It doesn't provide actually
valuable information and I can't see why this is an error condition anyway.

> don't throw errors in the core API modules like couch_db
> --------------------------------------------------------
>
>                 Key: COUCHDB-2050
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2050
>             Project: CouchDB
>          Issue Type: Improvement
>      Security Level: public(Regular issues) 
>          Components: Database Core
>            Reporter: Benoit Chesneau
>
> If we look at the code of {{couch_db:open/2}} for example, we are catching error in it
and rethrowing them. Where a more convenient pattern would be to return {ok, db} | {error,
Error} . 
> While throwing easier makes catching Error in the HTTP layer currently, it force us to
catch calls in other cases when you are working for example to an Erlang module.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message