Skip to content

Commit 69a9e1b

Browse files
committed
Fix type bug throwing unnecessary exception
1 parent cb76cd5 commit 69a9e1b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

runtime/runtime-core/common/src/aws/smithy/kotlin/runtime/businessmetrics/BusinessMetricsUtils.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ public enum class SmithyBusinessMetric(public override val identifier: String) :
8282
* Emits a business metric if the current [Attributes] instance is of type [ExecutionContext].
8383
*/
8484
@InternalApi
85-
public fun Attributes.emitBusinessMetric(metric: BusinessMetric): Unit =
86-
when (this) {
87-
is ExecutionContext -> this.emitBusinessMetric(metric)
88-
else -> throw UnsupportedOperationException("Business metric emission is supported only for attributes of type 'execution context'")
89-
}
85+
public fun Attributes.emitBusinessMetric(metric: BusinessMetric) {
86+
if (this is ExecutionContext) this.emitBusinessMetric(metric)
87+
}

0 commit comments

Comments
 (0)