Add unit tests.

Do you have any suggestions for a better error message? We don't have any more data than that.

I think that those two cases (python/java exception) only apply to the devappserver and they may well be obsolete there. I'll have to check.