fix(MQTT Node): Close connection if connection attempt fails (#10873)

This commit is contained in:
Tomi Turtiainen
2024-09-18 20:03:18 +03:00
committed by GitHub
parent 0a317b7072
commit ee7147c6b3
3 changed files with 46 additions and 10 deletions

View File

@@ -8,6 +8,7 @@ import {
type INodeType,
type INodeTypeDescription,
NodeConnectionType,
ensureError,
} from 'n8n-workflow';
import { createClient, type MqttCredential } from './GenericFunctions';
@@ -116,10 +117,12 @@ export class Mqtt implements INodeType {
try {
const client = await createClient(credentials);
client.end();
} catch (error) {
} catch (e) {
const error = ensureError(e);
return {
status: 'Error',
message: (error as Error).message,
message: error.message,
};
}
return {