Remote procedure call failure URI and parameters

23 views
Skip to first unread message

Rosa Lisin

unread,
Sep 17, 2015, 12:21:16 PM9/17/15
to CppWAMP
Hello,
I've been using cppwamp for a few months and I've been quite happy with the implementation so far. However, I've noticed that there is no easy way to extract URI and argumants from wamp::error::Failure instance. Surely what() method encodes all info in a string, but I want to propagate Failure URI and parameters to my application, and it seems silly to parse the string returned by what(). Am I overlooking something?

try{
}
catch(wamp::error::Failure& e){
 // how do I get URI, args, and kwargs from e?

Regards,
Rosa Lisin

Emile Cormier

unread,
Sep 17, 2015, 12:34:33 PM9/17/15
to CppWAMP
Rosa,

Thank you for using CppWAMP. I am glad to hear its been useful to you.

The Rpc object now has the captureError() option which takes a reference to an Error object. See http://ecorm.github.io/cppwamp/doc/classwamp_1_1_rpc.html#a0fefbcb96fc3825fefb4d947701d93ab

Error::reason provides the error URI. Error also inherits from Payload, which allows you to access the error arguments returned by the Caller.

I have not updated the tutorials to show usage of this new feature. I will update the tutorials as soon as I have the chance. I have added issue #81 to remind myself: https://github.com/ecorm/cppwamp/issues/81.

Hope this helps,
Emile

Emile Cormier

unread,
Sep 17, 2015, 3:33:16 PM9/17/15
to CppWAMP
I might revise the design a bit for easier use. I'll keep you posted.

Rosa Lisin

unread,
Sep 17, 2015, 4:05:43 PM9/17/15
to CppWAMP
Thanks a lot, Emile!
It turned out I had an older cppwamp version, that did not have captureError method in Rpc class! I knew I am missing something...
Anyway, I must complement you on the cppwamp library design and implementation. I've started using cppwamp after struggling with autobahnCpp for a while and giving up on it because of unimplemented features and inconvenience of interfaces. Cppwamp is very well thought through, with intuitive and convenient interfaces and elegant design - way better then autobahnCpp.  

Regards,
Rosa
Reply all
Reply to author
Forward
0 new messages