@@ -38,10 +38,11 @@ const FIRST_PARTY_PARSERS: Record<CodeConnectExecutableParser, ParserInfo> = {
3838 command : async ( cwd , config , mode ) => {
3939 const gradlewPath = await getGradleWrapperPath ( cwd , ( config as any ) . gradleWrapperPath )
4040 const gradleExecutableInvocation = getGradleWrapperExecutablePath ( gradlewPath )
41+ const verboseFlags = ( config as any ) . verbose ? ' --stacktrace' : ''
4142 if ( mode === 'CREATE' ) {
42- return `${ gradleExecutableInvocation } -p ${ gradlewPath } createCodeConnect -PfilePath=${ temporaryIOFilePath } -q `
43+ return `${ gradleExecutableInvocation } -p ${ gradlewPath } createCodeConnect -PfilePath=${ temporaryIOFilePath } ${ verboseFlags } `
4344 } else {
44- return `${ gradleExecutableInvocation } -p ${ gradlewPath } parseCodeConnect -PfilePath=${ temporaryIOFilePath } -q `
45+ return `${ gradleExecutableInvocation } -p ${ gradlewPath } parseCodeConnect -PfilePath=${ temporaryIOFilePath } ${ verboseFlags } `
4546 }
4647 } ,
4748 temporaryIOFilePath : temporaryIOFilePath ,
@@ -82,7 +83,11 @@ export async function callParser(
8283 return new Promise < object > ( async ( resolve , reject ) => {
8384 try {
8485 const parser = getParser ( config )
85- const command = await parser . command ( cwd , config , payload . mode )
86+ const configWithVerbose = {
87+ ...config ,
88+ verbose : ( payload as any ) . verbose ,
89+ }
90+ const command = await parser . command ( cwd , configWithVerbose , payload . mode )
8691 if ( parser . temporaryIOFilePath ) {
8792 fs . mkdirSync ( path . dirname ( parser . temporaryIOFilePath ) , { recursive : true } )
8893 fs . writeFileSync ( temporaryIOFilePath , JSON . stringify ( payload ) )
@@ -162,9 +167,16 @@ export async function callParser(
162167 child . stdin . end ( )
163168 }
164169 } catch ( e ) {
165- exitWithError (
166- `Error calling parser: ${ e } . Try re-running the command with --verbose for more information.` ,
167- )
170+ if ( ( payload as any ) . verbose ) {
171+ console . trace ( e )
172+
173+ // Don't say to enable verbose if the user has already enabled it.
174+ exitWithError ( `Error calling parser: ${ e } .` )
175+ } else {
176+ exitWithError (
177+ `Error calling parser: ${ e } . Try re-running the command with --verbose for more information.` ,
178+ )
179+ }
168180 }
169181 } )
170182}
0 commit comments