Allow application defined errors

Hi,

I needed to return some application defined errors which your JSON-RPC implementation did not allow (application error code was given as an "Internal error" _parameter_). I changed code and API as well as the example (which, unfortunately, I could not test).

Thanks you for this lib!