You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by PeeDub <pf...@greenarrowlabs.com> on 2018/02/19 17:21:58 UTC

void return type for client API

I see that (for example) AccessTokenService.logout() returns a *void* type.
Wouldn't it be helpful to return a Response type such that you could
diagnose an error if it occurs? One could tell if it was successful or not
by the Response status code. As it is, you can not possibly tell from the
client API whether the call succeeded or not.

Thanks,
Paul

--
Sent from: http://syncope-user.1051894.n5.nabble.com/

Re: void return type for client API

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 19/02/2018 18:21, PeeDub wrote:
> I see that (for example) AccessTokenService.logout() returns a *void* type.
> Wouldn't it be helpful to return a Response type such that you could
> diagnose an error if it occurs? One could tell if it was successful or not
> by the Response status code. As it is, you can not possibly tell from the
> client API whether the call succeeded or not.

If you are using the Syncope Client Library, when any API call (either 
returning void or something else) does not succeed, the 
RestClientExceptionMapper [1] will turn the reported error into a proper 
Java exception.

Regards.

[1] 
https://github.com/apache/syncope/blob/2_0_X/client/lib/src/main/java/org/apache/syncope/client/lib/RestClientExceptionMapper.java

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Member at The Apache Software Foundation
Syncope, Cocoon, Olingo, CXF, OpenJPA, PonyMail
http://home.apache.org/~ilgrosso/