@@ -226,7 +226,7 @@ async function runMultipleHandler(mode: `all`|`selected`|`from`) {
226
226
try {
227
227
await runHandler ( statementInfo ) ;
228
228
} catch ( e ) {
229
- vscode . window . showErrorMessage ( `Error running statement: ${ e instanceof Error ? e . message : e } ` ) ;
229
+ // No error needed. runHandler still shows an error.
230
230
break ;
231
231
}
232
232
}
@@ -305,7 +305,11 @@ async function runHandler(options?: StatementInfo) {
305
305
const command = statementDetail . content . split ( ` ` ) [ 0 ] . toUpperCase ( ) ;
306
306
307
307
chosenView . setLoadingText ( `Running CL command... (${ command } )` , false ) ;
308
- await JobManager . runSQLVerbose ( statementDetail . content , { isClCommand : true } ) ; // Can throw
308
+ // CL does not throw
309
+ const result = await JobManager . runSQLVerbose < { SUMMARY : string } > ( statementDetail . content , { isClCommand : true } ) ;
310
+ if ( ! result . success ) {
311
+ throw new Error ( result . data && result . data [ 0 ] ? result . data [ 0 ] . SUMMARY : `CL command ${ command } executed successfully.` ) ;
312
+ }
309
313
310
314
} else {
311
315
if ( inWindow ) {
@@ -318,7 +322,7 @@ async function runHandler(options?: StatementInfo) {
318
322
// If it's a basic statement, we can let it scroll!
319
323
if ( statementDetail . noUi ) {
320
324
chosenView . setLoadingText ( `Running SQL statement... (${ possibleTitle } )` , false ) ;
321
- await JobManager . runSQLVerbose ( statementDetail . content , undefined , 1 ) ;
325
+ await JobManager . runSQL ( statementDetail . content , undefined , 1 ) ;
322
326
323
327
} else {
324
328
if ( inWindow ) {
@@ -445,7 +449,7 @@ async function runHandler(options?: StatementInfo) {
445
449
errorText = e . message || `Error running SQL statement.` ;
446
450
}
447
451
448
- if ( [ `statement` , `explain` , `onlyexplain` ] . includes ( statementDetail . qualifier ) && statementDetail . history !== false ) {
452
+ if ( [ `statement` , `explain` , `onlyexplain` , `cl` ] . includes ( statementDetail . qualifier ) && statementDetail . history !== false ) {
449
453
chosenView . setError ( errorText ) ;
450
454
} else {
451
455
vscode . window . showErrorMessage ( errorText ) ;
0 commit comments