[Trunk | Orcid Service]: UserTokensController.java: In "getPersonalDetailsFromOrcid()" method (/orcid/personal-details), when getting error response from ORCID API, throw Exception.
This commit is contained in:
parent
92a487e3f8
commit
f72dcedbd5
|
@ -107,7 +107,7 @@ public class UserTokensController {
|
|||
}
|
||||
|
||||
@RequestMapping(value = "/orcid/personal-details", method = RequestMethod.GET)
|
||||
public String getPersonalDetailsFromOrcid() throws BadPaddingException, InvalidKeyException, NoSuchAlgorithmException, IllegalBlockSizeException, IOException, NoSuchPaddingException, InvalidAlgorithmParameterException, InvalidKeySpecException {
|
||||
public String getPersonalDetailsFromOrcid() throws Exception {
|
||||
log.debug("getPersonalDetailsFromOrcid");
|
||||
|
||||
UserTokens userTokens = userTokensService.getUserTokens();
|
||||
|
@ -144,7 +144,13 @@ public class UserTokensController {
|
|||
if (response.getStatusCode() != HttpStatus.OK) {
|
||||
orcid_log.error("Getting user details response code is: " + response.getStatusCode());
|
||||
orcid_log.error("Unexpected Response: "+response.getBody());
|
||||
return null;
|
||||
|
||||
if(response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
|
||||
throw new AuthorizationServiceException("You are not allowed to get personal details");
|
||||
} else {
|
||||
throw new Exception("Internal server error");
|
||||
}
|
||||
// return null;
|
||||
} else {
|
||||
orcid_log.info("response: "+response);
|
||||
return response.getBody().toString();
|
||||
|
|
Loading…
Reference in New Issue