Skip to content

Commit b6175d8

Browse files
authored
Merge pull request #689 from swftvsn/patch-2
Wrap executePacket.toPacket(1) call with try/catch
2 parents 1ff8890 + 9d46fbb commit b6175d8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/commands/execute.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ Execute.prototype.start = function(packet, connection) {
5050
this.parameters,
5151
connection.config.charsetNumber
5252
);
53-
connection.writePacket(executePacket.toPacket(1));
53+
//For reasons why this try-catch is here, please see
54+
// https://github.com/sidorares/node-mysql2/pull/689
55+
//For additional discussion, see
56+
// 1. https://github.com/sidorares/node-mysql2/issues/493
57+
// 2. https://github.com/sidorares/node-mysql2/issues/187
58+
// 3. https://github.com/sidorares/node-mysql2/issues/480
59+
try {
60+
connection.writePacket(executePacket.toPacket(1));
61+
} catch (error) {
62+
this.onResult(error)
63+
}
5464
return Execute.prototype.resultsetHeader;
5565
};
5666

0 commit comments

Comments
 (0)