File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,18 +176,29 @@ export class Domain {
176176 await this . customDomain . tryHandleAutoDomain ( ) ;
177177 const logger = GLogger . getLogger ( ) ;
178178 const domainName = await this . getDomainName ( ) ;
179- logger . write ( `Remove custom domain: ${ this . region } /${ domainName } ` ) ;
179+ const region = this . region ;
180+ logger . write ( `Remove custom domain: ${ region } /${ domainName } ` ) ;
180181 console . log ( ) ;
181182 const client = this . getFcClient ( 'remove' ) ;
182183 if ( this . yes ) {
183- await client . deleteCustomDomain ( domainName ) ;
184- logger . debug ( `delete custom domain ${ this . region } /${ domainName } success` ) ;
184+ await delCustomDomain ( ) ;
185185 return ;
186186 }
187187 const msg = `Do you want to delete this custom domain ${ this . region } /${ domainName } ` ;
188188 if ( await promptForConfirmOrDetails ( msg ) ) {
189- await client . deleteCustomDomain ( domainName ) ;
190- logger . debug ( `delete custom domain ${ this . region } /${ domainName } success` ) ;
189+ await delCustomDomain ( ) ;
190+ }
191+
192+ async function delCustomDomain ( ) {
193+ try {
194+ await client . deleteCustomDomain ( domainName ) ;
195+ logger . debug ( `delete custom domain ${ region } /${ domainName } success` ) ;
196+ } catch ( error ) {
197+ logger . error ( `delete custom domain error: ${ error } ` ) ;
198+ if ( error . code !== 'DomainNameNotFound' || error . statusCode !== 404 ) {
199+ throw error ;
200+ }
201+ }
191202 }
192203 }
193204
You can’t perform that action at this time.
0 commit comments