@@ -67,7 +67,9 @@ export async function executeQueriesMetadataCollectCommand(client, _options = {}
6767 // Write file with UTF-8 encoding
6868 await writeFile ( outputFile , output , "utf-8" ) ;
6969 } catch ( error ) {
70- throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` ) ;
70+ throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` , {
71+ cause : error
72+ } ) ;
7173 }
7274
7375 // Log summary to stderr
@@ -123,7 +125,9 @@ export async function executeQueriesMetadataProcessCommand(_client, _options = {
123125 // Write file with UTF-8 encoding
124126 await writeFile ( outputFile , output , "utf-8" ) ;
125127 } catch ( error ) {
126- throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` ) ;
128+ throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` , {
129+ cause : error
130+ } ) ;
127131 }
128132 } else {
129133 throw new Error (
@@ -179,7 +183,9 @@ export async function executeQueriesMetadataFilterCommand(_client, _options = {}
179183 // Write file with UTF-8 encoding
180184 await writeFile ( outputFile , output , "utf-8" ) ;
181185 } catch ( error ) {
182- throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` ) ;
186+ throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` , {
187+ cause : error
188+ } ) ;
183189 }
184190
185191 // Log summary to stderr
@@ -232,7 +238,9 @@ export async function executeResolveAllQueriesCommand(client, _options = {}) {
232238 // Write file with UTF-8 encoding
233239 await writeFile ( outputFile , output , "utf-8" ) ;
234240 } catch ( error ) {
235- throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` ) ;
241+ throw new Error ( `Failed to write output file ${ outputFile } : ${ error . message } ` , {
242+ cause : error
243+ } ) ;
236244 }
237245
238246 // Log summary to stderr
0 commit comments