Handle the case when the resource registry returns an exception when checking if the parent context exists.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/resource-management/resource-manager@162454 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
731dc6bde7
commit
8880bdddde
|
@ -34,8 +34,12 @@ public final class CreateRequest extends RequestToResourceRegistry {
|
||||||
@Override
|
@Override
|
||||||
public void validate() throws LocalCodeException {
|
public void validate() throws LocalCodeException {
|
||||||
if (Objects.nonNull(this.context.getParent())) {
|
if (Objects.nonNull(this.context.getParent())) {
|
||||||
Context parent = new Queries().fetchContext(this.context.getParent().getHeader().getUUID(), this.getContextClient());
|
try {
|
||||||
if (Objects.isNull(parent)) {
|
Context parent = new Queries().fetchContext(this.context.getParent().getHeader().getUUID(), this.getContextClient());
|
||||||
|
if (Objects.isNull(parent)) {
|
||||||
|
throw new LocalCodeException(RMCreateContextCode.CONTEXT_PARENT_DOES_NOT_EXIST);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
throw new LocalCodeException(RMCreateContextCode.CONTEXT_PARENT_DOES_NOT_EXIST);
|
throw new LocalCodeException(RMCreateContextCode.CONTEXT_PARENT_DOES_NOT_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue