Skip to content

Commit

Permalink
feat: remove execution if a given operation completes with an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Vazquez committed Jul 11, 2024
1 parent c8e9366 commit 8d615b9
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class SyncExecutionExhaustedState(
* for example:
* - parsing, validation errors
* - persisted query errors
* - an exception during execution was thrown
*/
private fun removeExecution(executionId: ExecutionId) {
if (executions.containsKey(executionId)) {
Expand All @@ -74,10 +75,8 @@ class SyncExecutionExhaustedState(
}
return object : SimpleInstrumentationContext<ExecutionResult>() {
override fun onCompleted(result: ExecutionResult?, t: Throwable?) {
result?.let {
if (result.errors.size > 0) {
removeExecution(parameters.executionInput.executionId)
}
if ((result != null && result.errors.size > 0) || t != null) {
removeExecution(parameters.executionInput.executionId)
}
}
}
Expand Down

0 comments on commit 8d615b9

Please sign in to comment.