Skip to content

Commit 7dd617c

Browse files
author
Kamal Nayan
committed
Unwrapped the exception
Signed-off-by: Kamal Nayan <askkamal@amazon.com>
1 parent 29f680f commit 7dd617c

File tree

1 file changed

+4
-2
lines changed
  • src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine

1 file changed

+4
-2
lines changed

src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/engine/SMStateMachine.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package org.opensearch.indexmanagement.snapshotmanagement.engine
77

88
import org.apache.logging.log4j.LogManager
99
import org.apache.logging.log4j.Logger
10+
import org.opensearch.ExceptionsHelper
1011
import org.opensearch.action.bulk.BackoffPolicy
1112
import org.opensearch.common.settings.Settings
1213
import org.opensearch.common.unit.TimeValue
@@ -123,8 +124,9 @@ class SMStateMachine(
123124
}
124125
} while (currentState.instance.continuous && result is SMResult.Next)
125126
} catch (ex: Exception) {
126-
@Suppress("InstanceOfCheckForException")
127-
if (ex !is VersionConflictEngineException) {
127+
val unwrappedException = ExceptionsHelper.unwrapCause(ex) as Exception
128+
129+
if (unwrappedException !is VersionConflictEngineException) {
128130
val message = "There was an exception at ${now()} while executing Snapshot Management policy ${job.policyName}, please check logs."
129131
job.notificationConfig?.sendFailureNotification(client, job.policyName, message, job.user, log)
130132
}

0 commit comments

Comments
 (0)