String errorMessage = String.format("Cannot instantiate process definition %s: %s", processDefinitionId, e.getMessage());
throw new InvalidRequestException(e.getStatus(), e, errorMessage);
}
ProcessInstanceDto result = ProcessInstanceDto.fromProcessInstance(instance);
URI uri = context.getBaseUriBuilder()
.path(rootResourcePath)
.path(ProcessInstanceRestService.PATH)
.path(instance.getId())
.build();
result.addReflexiveLink(uri, HttpMethod.GET, "self");
return result;
}