(handshakeDoc: Document, handshakeOptions: CommandOptions)
| 188 | conn.established = true; |
| 189 | |
| 190 | async function executeHandshake(handshakeDoc: Document, handshakeOptions: CommandOptions) { |
| 191 | try { |
| 192 | const handshakeResponse = await conn.command( |
| 193 | ns('admin.$cmd'), |
| 194 | handshakeDoc, |
| 195 | handshakeOptions |
| 196 | ); |
| 197 | return handshakeResponse; |
| 198 | } catch (error) { |
| 199 | if (error instanceof MongoError) { |
| 200 | error.addErrorLabel(MongoErrorLabel.HandshakeError); |
| 201 | } |
| 202 | // If we encounter a network error executing the initial handshake, apply backpressure labels. |
| 203 | if (error instanceof MongoNetworkError) { |
| 204 | applyBackpressureLabels(error); |
| 205 | } |
| 206 | |
| 207 | throw error; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | /** |
no test coverage detected