couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [18/50] git commit: Throw unknown_error for non standard errors
Date Sat, 18 Jan 2014 00:47:43 GMT
Throw unknown_error for non standard errors

Right now unless you throw an error with the key forbidden or
unauthorized, we throw a stack trace back at you. This will at least let
you throw a string as an error message.

Whether or not we should return unknown_error: Message or throw an error
saying invalid error format in the validate_doc_update function is
debateable.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/8eb26361
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/8eb26361
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/8eb26361

Branch: refs/heads/import
Commit: 8eb2636106fe4fc90135ead3565761da775c2d24
Parents: df395bf
Author: Russell Branca <chewbranca@gmail.com>
Authored: Wed Jan 23 14:03:24 2013 -0800
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Fri Jan 17 16:44:30 2014 -0800

----------------------------------------------------------------------
 src/couch_query_servers.erl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/8eb26361/src/couch_query_servers.erl
----------------------------------------------------------------------
diff --git a/src/couch_query_servers.erl b/src/couch_query_servers.erl
index 71dcae9..5864288 100644
--- a/src/couch_query_servers.erl
+++ b/src/couch_query_servers.erl
@@ -327,7 +327,9 @@ validate_doc_update(DDoc, EditDoc, DiskDoc, Ctx, SecObj) ->
         {[{<<"forbidden">>, Message}]} ->
             throw({forbidden, Message});
         {[{<<"unauthorized">>, Message}]} ->
-            throw({unauthorized, Message})
+            throw({unauthorized, Message});
+        <<Message/binary>> ->
+            throw({unknown_error, Message})
     end.
 
 json_doc(nil) -> null;


Mime
View raw message