Throw non-generic exceptions

Posted by deepakjois:

We currently throw Exception from the public methods of DgraphClient. It would be nice to throw some less generic and specific to Dgraph.

deepakjois commented :

@liqweed made a few suggestions, which I believe are worth implementing.

  • Would you please consider making the TxnException types RuntimeExceptions? That’s a long debate, but checked exceptions are such pain to work with and really complicate things when applying functional paradigms in Java.
  • I’d introduce a general TxnException. The more specific types can extend it. There can be many more error cases, not all of which merit an specializing exception type. You’d probably benefit from an even more generic DgraphException.
  • Could you please extract these Exceptions to their own java files?

deepakjois commented :

All suggestions implemented in 951234223001e