(errorCode, err)
| 282 | } |
| 283 | |
| 284 | _handleError(errorCode, err) { |
| 285 | this._parent.triedHosts[this._host.address] = err; |
| 286 | err['coordinator'] = this._host.address; |
| 287 | |
| 288 | if (errorCode === errorCodes.serverErrorUnprepared) { |
| 289 | return this._prepareAndRetry(err.queryId); |
| 290 | } |
| 291 | |
| 292 | if (errorCode === errorCodes.socketError || errorCode === errorCodes.socketErrorBeforeRequestWritten) { |
| 293 | this._host.removeFromPool(this._connection); |
| 294 | } else if (errorCode === errorCodes.clientTimeout) { |
| 295 | this._parent.log('warning', err.message); |
| 296 | this._host.checkHealth(this._connection); |
| 297 | } |
| 298 | |
| 299 | const decisionInfo = this._getDecision(errorCode, err); |
| 300 | |
| 301 | if (!decisionInfo || decisionInfo.decision === retry.RetryPolicy.retryDecision.rethrow) { |
| 302 | if (this._request instanceof requests.QueryRequest || this._request instanceof requests.ExecuteRequest) { |
| 303 | err['query'] = this._request.query; |
| 304 | } |
| 305 | return this._parent.setCompleted(err); |
| 306 | } |
| 307 | |
| 308 | const metrics = this._parent.client.metrics; |
| 309 | |
| 310 | if (decisionInfo.decision === retry.RetryPolicy.retryDecision.ignore) { |
| 311 | metrics.onIgnoreError(err); |
| 312 | |
| 313 | // Return an empty ResultSet |
| 314 | return this._parent.setCompleted(null, this._getResultSet(utils.emptyObject)); |
| 315 | } |
| 316 | |
| 317 | RequestExecution._invokeMetricsHandlerForRetry(errorCode, metrics, err); |
| 318 | |
| 319 | return this._retry(decisionInfo.consistency, decisionInfo.useCurrentHost); |
| 320 | } |
| 321 | |
| 322 | /** |
| 323 | * Gets a decision whether or not to retry based on the error information. |
no test coverage detected