[ https://issues.apache.org/jira/browse/COUCHDB-2050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13893278#comment-13893278
]
Robert Newson commented on COUCHDB-2050:
----------------------------------------
Let's keep in mind how difficult deep changes like that are for hot code upgrades. Post-merge,
couchdb should be capable of zero-downtime upgrades (I grant it'll take a couple of iterations
to make that a reality). I don't want to use this as a stick to beat off any deep and sensible
changes, but it's not a factor to ignore.
We should have some guidelines on when to throw and when to return error tuples, as well as
guidelines on when to simply function_clause (the many {ok, Thing} = mod:fun(args) patterns,
making all of those test the result will be very burdensome and unidiomatic).
Erlang makes things a little more fun by having three ways to throw (there's exit, error and
throw).
> 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)