You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2022/05/11 15:35:42 UTC

[GitHub] [couchdb] nickva opened a new pull request, #4020: Fix maybe_handle_error clauses

nickva opened a new pull request, #4020:
URL: https://github.com/apache/couchdb/pull/4020

   `{shutdown, Err}` should come before `{Err Reason}`, otherwise {Err, Reason} will always match.
   
   Also, plugin `handle_error/1` response was forced to match initial `Error`, which doesn't have to always be the case based on https://github.com/apache/couchdb/blob/42f2c1c534ed5c210b45ffcd9a621a31b781b5ae/src/chttpd/src/chttpd_plugin.erl#L39-L41
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva commented on a diff in pull request #4020: Fix maybe_handle_error clauses

Posted by GitBox <gi...@apache.org>.
nickva commented on code in PR #4020:
URL: https://github.com/apache/couchdb/pull/4020#discussion_r870487699


##########
src/chttpd/src/chttpd.erl:
##########
@@ -1134,14 +1134,14 @@ maybe_handle_error(Error) ->
     case chttpd_plugin:handle_error(Error) of
         {_Code, _Reason, _Description} = Result ->
             Result;
+        {shutdown, Err} ->
+            exit({shutdown, Err});
         {Err, Reason} ->
             {500, couch_util:to_binary(Err), couch_util:to_binary(Reason)};
         normal ->
             exit(normal);
-        {shutdown, Err} ->
-            exit({shutdown, Err});
-        Error ->
-            {500, <<"unknown_error">>, couch_util:to_binary(Error)}
+        Error1 ->

Review Comment:
   Agree. Good idea.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] jaydoane commented on a diff in pull request #4020: Fix maybe_handle_error clauses

Posted by GitBox <gi...@apache.org>.
jaydoane commented on code in PR #4020:
URL: https://github.com/apache/couchdb/pull/4020#discussion_r870479534


##########
src/chttpd/src/chttpd.erl:
##########
@@ -1134,14 +1134,14 @@ maybe_handle_error(Error) ->
     case chttpd_plugin:handle_error(Error) of
         {_Code, _Reason, _Description} = Result ->
             Result;
+        {shutdown, Err} ->
+            exit({shutdown, Err});
         {Err, Reason} ->
             {500, couch_util:to_binary(Err), couch_util:to_binary(Reason)};
         normal ->
             exit(normal);
-        {shutdown, Err} ->
-            exit({shutdown, Err});
-        Error ->
-            {500, <<"unknown_error">>, couch_util:to_binary(Error)}
+        Error1 ->

Review Comment:
   When I see `Error1` I think maybe it's a modification of the original `Error`, but all the other case clauses use `Err`. Would that perhaps be easier to read?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [couchdb] nickva merged pull request #4020: Fix maybe_handle_error clauses

Posted by GitBox <gi...@apache.org>.
nickva merged PR #4020:
URL: https://github.com/apache/couchdb/pull/4020


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org