@@ -46,17 +46,17 @@ DeleteContentTypes.prototype = {
4646 log . success ( 'All mentioned contentTypes deleted successfully' ) ;
4747 return resolve ( ) ;
4848 }
49-
5049 } ) . catch ( function ( error ) {
5150 // eslint-disable-next-line no-console
5251 return reject ( error ) ;
5352 } ) ;
5453 } else {
5554 return reject ( ) ;
5655 }
57-
58- console . log ( answer ) ;
59- } ) ;
56+ } ) . catch ( function ( error ) {
57+ // eslint-disable-next-line no-console
58+ return reject ( error ) ;
59+ } ) ;
6060 } else {
6161 const confirm = new Confirm ( 'Are you sure, you want to delete All ContentTypes of' + " " + config . stack . name + " " + "stack" )
6262 . run ( )
@@ -89,8 +89,12 @@ DeleteContentTypes.prototype = {
8989 log . success ( contenttype + ' ' + 'contenttype deleted successfully' ) ;
9090 }
9191 } ) . catch ( function ( error ) {
92- log . error ( chalk . red ( error . body . error ) ) ;
93- self . pending . push ( contenttype ) ;
92+ log . error ( chalk . red ( error . body . error_message ) ) ;
93+ if ( error . body . error_code === 117 ) {
94+ self . pending . push ( contenttype ) ;
95+ }
96+ return reject ( error )
97+
9498 } )
9599 } , {
96100 concurrency : 1
@@ -111,9 +115,21 @@ DeleteContentTypes.prototype = {
111115 return self . deleteAllContentTypes ( content_types ) . then ( function ( ) {
112116 if ( self . pending && self . pending . length > 0 ) {
113117 self . pendingContentTypes ( ) . then ( function ( ) {
114- log . success ( 'Pending contentTypes deletion completed' ) ;
115118 return resolve ( ) ;
116- } )
119+ // if(self.pending.length > 0) {
120+ // self.pendingContentTypes().then(function() {
121+ // log.success('Pending contentTypes deletion successfully!!!!');
122+ // console.log("ndcdncmdncdmcd")
123+ // })
124+ // } else {
125+ // log.success('Pending contentTypes deletion completed11111111');
126+ // return resolve();
127+ // }
128+
129+ } ) . catch ( function ( error ) {
130+ // eslint-disable-next-line no-console
131+ return reject ( error ) ;
132+ } ) ;
117133 } else {
118134 return resolve ( ) ;
119135 }
@@ -141,7 +157,7 @@ DeleteContentTypes.prototype = {
141157 log . success ( contenttype . uid + ' ' + 'contenttype deleted successfully' ) ;
142158 }
143159 } ) . catch ( function ( error ) {
144- log . error ( chalk . red ( error . body . error ) ) ;
160+ log . error ( chalk . red ( error . body . error_message ) ) ;
145161 self . pending . push ( contenttype . uid ) ;
146162 } )
147163 } , {
@@ -150,31 +166,32 @@ DeleteContentTypes.prototype = {
150166 return resolve ( ) ;
151167 } ) . catch ( function ( error ) {
152168 return reject ( ) ;
153- // console.log("errrorMapper", error);
154169 } )
155170 } )
156171 } ,
157172 pendingContentTypes : function ( ) {
158173 var self = this ;
159174 return new Promise ( function ( resolve , reject ) {
160175 return Promise . map ( self . pending , function ( contenttype ) {
161- //var contenttypeUid = contenttype.uid;
162176 self . requestOptions [ 'url' ] = config . host + config . apis . content_types + contenttype
163177 self . requestOptions [ 'method' ] = 'DELETE'
178+ console . log ( "selddddddd" , self )
164179 return request ( self . requestOptions ) . then ( function ( response_data ) {
165180 if ( response_data . statusCode == 200 ) {
166- log . success ( contenttype + ' ' + 'contenttype deleted successfully' ) ;
167- }
181+ log . success ( "Referred " + contenttype + ' ' + 'contenttype deleted successfully' ) ;
182+ // var n = self.pending.indexOf(contenttype);
183+ // var y = self.pending.splice(n,1);
184+ }
185+ return resolve ( ) ;
168186 } ) . catch ( function ( error ) {
169- log . error ( error ) ;
187+ return reject ( error ) ;
170188 } )
171189 } , {
172190 concurrency : 1
173191 } ) . then ( function ( ) {
174192 return resolve ( ) ;
175193 } ) . catch ( function ( error ) {
176194 return reject ( error ) ;
177- // console.log("errrorMapper", error);
178195 } )
179196 } ) ;
180197 }
0 commit comments