brownsys / pane

Participatory Networking
http://pane.cs.brown.edu
Other
5 stars 4 forks source link

Return error messages to clients #26

Open adferguson opened 12 years ago

adferguson commented 12 years ago

Parse errors and server errors should be sent to the client, rather than appear in the server console. To quote Arjun:

I'll have to write it from safari, but here is the basic idea.

The operations in FlowController.hs return (Maybe State), which means on error they simply return Nothing (no error message).

Change the return type to Either String State. On success, return Left errMessage and on failure return Right newState

You can do this to just one function without changing everything.

arjunguha commented 12 years ago

This is done. (DNPResult)

adferguson commented 12 years ago

This is not done at all --- DNPResult (now just "Result") is only to return non-boolean results to clients. All error messages still go to the server console.

adferguson commented 12 years ago

As we make progress on this issue, we should think about how to improve/design the exceptions in the Java client. In particular, we should be mindful of the distinction between exceptions which the PANE client can recover from (eg, by trying again), those which convey an invalid request (eg, authorization fail), and those which are totally wrong (eg, malformed request).

Here are some good pointers to help our thinking: http://today.java.net/article/2006/04/04/exception-handling-antipatterns https://github.com/apache/zookeeper/blob/trunk/src/java/main/org/apache/zookeeper/KeeperException.java