You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Klaus Trainer (JIRA)" <ji...@apache.org> on 2014/02/06 11:52:09 UTC

[jira] [Commented] (COUCHDB-2050) don't throw errors in the core API modules like couch_db

    [ 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)