hacksong / jsonrpc4j

Automatically exported from code.google.com/p/jsonrpc4j
0 stars 0 forks source link

Feature request: map exceptions in service to JSON-RPC errors #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
We've started using jsonrpc4j at my company and it's working great. The Spring 
integration makes it very quick to get up and running.

We needed a way to map exceptions in the service to custom JSON-RPC error codes 
so I've added two annotations for the service interfaces: @JsonRpcErrors and 
@JsonRpcError.

This feature is also requested by Alexander Lepekhin in the discussion group. I 
think a solution with annotations for the service interface is better than a 
specific exception since it avoids coupling between the service and jsonrpc4j.

I've attached a patch which includes junit tests for the annotations. Here's a 
usage example:

JsonRpcErrors({@JsonRpcError(exception=TestException.class, code=12345, 
message="Error message", data="Additional data") })

best regards,

-- 
Hans Jørgen Hoel
NHST Media Group

Original issue reported on code.google.com by hansj...@gmail.com on 30 May 2011 at 8:16

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch Hans - it has been applied on the 0.17-SNAPSHOT version.  
A new release will come shortly.  I've got another patch from another user that 
i need to review first.  Would you mind verifying the fix in the 0.17-SNAPSHOT 
version before i cut a new release?

Original comment by brian.di...@gmail.com on 3 Jun 2011 at 10:08

GoogleCodeExporter commented 9 years ago
I've verified the patch on svn trunk. Thanks for adding it.

We've also got another feature request with a patch (for relaxing the 
requirements to number of parameters on a service method). I'll create a 
separate issue for that.

Original comment by hansj...@gmail.com on 6 Jun 2011 at 11:15

GoogleCodeExporter commented 9 years ago

Original comment by brian.di...@gmail.com on 25 May 2012 at 2:51

GoogleCodeExporter commented 9 years ago

Original comment by brian.di...@gmail.com on 26 May 2012 at 2:43