Repository: couchdb-fabric Updated Branches: refs/heads/master d67049cca -> 31be53240
Return forbidden error if encountered on any shard This commit fixes an issue which caused HTTP 500 errors to be returned when an authorized user attempted to access a database that they did not have permission to access, when cassim is disabled. Instead of returning an internal server error once all shards have failed to open we add a receive clause so that we throw a forbidden error if one is encountered on any shard. This is the same approach we already take for unauthorized errors. Closes COUCHDB-2948 This closes #38 Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/31be5324 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/31be5324 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/31be5324 Branch: refs/heads/master Commit: 31be5324023771fa80bfe8a28a31f6592cb28af0 Parents: d67049c Author: Mike Wallace <mikewall...@apache.org> Authored: Tue Feb 9 14:31:55 2016 +0000 Committer: Mike Wallace <mikewall...@apache.org> Committed: Wed Feb 10 11:59:23 2016 +0000 ---------------------------------------------------------------------- src/fabric_util.erl | 2 ++ 1 file changed, 2 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/31be5324/src/fabric_util.erl ---------------------------------------------------------------------- diff --git a/src/fabric_util.erl b/src/fabric_util.erl index ef40484..522a1d2 100644 --- a/src/fabric_util.erl +++ b/src/fabric_util.erl @@ -187,6 +187,8 @@ get_shard([#shard{node = Node, name = Name} | Rest], Opts, Timeout, Factor) -> {ok, Db}; {Ref, {'rexi_EXIT', {{unauthorized, _} = Error, _}}} -> throw(Error); + {Ref, {'rexi_EXIT', {{forbidden, _} = Error, _}}} -> + throw(Error); {Ref, _Else} -> get_shard(Rest, Opts, Timeout, Factor) after Timeout ->