mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(Microsoft SQL Node): Handle connection errors correctly with continueOnFail (#15962)
This commit is contained in:
@@ -247,13 +247,24 @@ export class MicrosoftSql implements INodeType {
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const credentials = await this.getCredentials('microsoftSql');
|
||||
|
||||
const pool = configurePool(credentials);
|
||||
await pool.connect();
|
||||
|
||||
let responseData: IDataObject | IDataObject[] = [];
|
||||
let returnData: INodeExecutionData[] = [];
|
||||
|
||||
const items = this.getInputData();
|
||||
const pairedItem = generatePairedItemData(items.length);
|
||||
|
||||
const pool = configurePool(credentials);
|
||||
try {
|
||||
await pool.connect();
|
||||
} catch (error) {
|
||||
void pool.close();
|
||||
|
||||
if (this.continueOnFail()) {
|
||||
return [[{ json: { error: error.message }, pairedItem }]];
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
const nodeVersion = this.getNode().typeVersion;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user