@@ -77,24 +77,17 @@ public class AddAsNewCmd extends AbstractStudiosCmd{
7777 protected Response exec () throws ApiException {
7878 Long wspId = workspaceId (workspace .workspace );
7979
80- try {
81- String parentStudioSessionId = getParentStudioSessionId (parentStudioRefOptions , wspId );
82- DataStudioDto parentStudio = studiosApi ().describeDataStudio (parentStudioSessionId , wspId );
83- if (parentStudio == null ) {
84- throw new TowerException (String .format ("Parent Studio %s not found at %s workspace" , parentStudioSessionId , wspId ));
85- }
86-
87- DataStudioCreateRequest request = prepareRequest (parentStudio , parentCheckpointId , wspId );
88- DataStudioCreateResponse response = studiosApi ().createDataStudio (request , wspId , autoStart );
89- DataStudioDto studioDto = response .getStudio ();
90- assert studioDto != null ;
91- return new StudiosCreated (studioDto .getSessionId (), wspId , workspaceRef (wspId ), baseWorkspaceUrl (wspId ), autoStart );
92- } catch (ApiException e ) {
93- if (e .getCode () == 403 ) {
94- throw new TowerException (String .format ("User not entitled to create studio at %s workspace" , wspId ));
95- }
96- throw e ;
80+ String parentStudioSessionId = getParentStudioSessionId (parentStudioRefOptions , wspId );
81+ DataStudioDto parentStudio = studiosApi ().describeDataStudio (parentStudioSessionId , wspId );
82+ if (parentStudio == null ) {
83+ throw new TowerException (String .format ("Parent Studio %s not found at %s workspace" , parentStudioSessionId , wspId ));
9784 }
85+
86+ DataStudioCreateRequest request = prepareRequest (parentStudio , parentCheckpointId , wspId );
87+ DataStudioCreateResponse response = studiosApi ().createDataStudio (request , wspId , autoStart );
88+ DataStudioDto studioDto = response .getStudio ();
89+ assert studioDto != null ;
90+ return new StudiosCreated (studioDto .getSessionId (), wspId , workspaceRef (wspId ), baseWorkspaceUrl (wspId ), autoStart );
9891 }
9992
10093 DataStudioCreateRequest prepareRequest (DataStudioDto parentDataStudio , String parentCheckpointId , Long wspId ) throws ApiException {
0 commit comments