Closed hey-red closed 8 years ago
It looks like from the specification (as far as i can tell) that the errors it returns is just about rpc processing except for the -32000 to -32099 range of error codes which can be customized per implementation. I have no way right now to have those be set, but it is a thing I have been thinking about and working on. I plan to have a MVC like way of returning the errors such as returing Ok(responseObject) or BadRequest("ErrorMessage") but havent quite figured it out. The only way to do it right now is to return a wrapper object that holds a result/error code for your request. This is the next thing that I will be implementing.
All codes >-32000 or <-32768 application defined errors.
From what I get the range -32000 to -32099. Is reserved for the application while the -32100 to -32768 are reserved for future use for the routing. So a user should only be doing a custom error that is between -32000 to -32099. Otherwise the router should handle it.
Look at the updated README.md to see the new IRpcMethodResult return type. Also this is pushed to nuget but as a prerelease
Ill change it to allow all error codes
Updated Nuget package
From JSON RPC specification How to create app defined error response? Throwing RpcException in user input validation it's bad way. Maybe pass rpc obj through DI and use method like SetErrorResponse in RPC controller?