Re the parsing error handling: All API exceptions are already logged by the wrapper, so we should be OK. This parsing error can happen only if someone tries to get Mambu response details from the  exception not generated by Mambu server (e.g. generated by the wrapper itself). In these cases the error code is always -1 and there is no Mambu formatted response.  So setting returnCode to -1 should probably be enough. And, of course, the whole exception message is always still available via e.getMessage().

I addressed all other review comments and merged with the latest from mambu-gmbh, so the pull request should be ready for merge.

Note: Thomas, I had some conflicts in /lib so please double check during pull request merge that I'm not unnecessary updating anything in /lib (though all lib files should be identical anyway). Thanks.

On Mar 13, 2014, at 3:44 AM, thobach <notifications@github.com> wrote:

> In src/com/mambu/apisdk/exception/MambuApiResponseMessage.java:
> 
> > @@ -60,17 +61,28 @@ public MambuApiResponseMessage(String mambuResponse) {
> >  			return;
> >  		}
> >  
> > -		MambuApiResponseMessage obj = (MambuApiResponseMessage) GsonUtils.createGson().fromJson(mambuResponse,
> > -				MambuApiResponseMessage.class);
> > -		if (obj == null) {
> > +		MambuApiResponseMessage obj = null;
> > +
> > +		// Need to check for valid Json format: not all Mambu exceptions would have properly formatted response
> > +		// (returnCode, returnStatus, errorSource). Mambu exceptions thrown for IO errors, for example, do not.
> > +
> > +		try {
> > +
> > +			obj = (MambuApiResponseMessage) GsonUtils.createGson().fromJson(mambuResponse,
> > +					MambuApiResponseMessage.class);
> > +
> > +		} catch (JsonSyntaxException e) {
> Is there a way to indicate in the response that there was a problem parsing the JSON and add a log message as well? Maybe it makes sense to include the actual response (mambuResponse) in the log message as well, or could that be a security issue?
> 
> —
> Reply to this email directly or view it on GitHub.
>