Skip to content

Commit

Permalink
Fix type bug throwing unnecessary exception
Browse files Browse the repository at this point in the history
  • Loading branch information
0marperez committed Oct 24, 2024
1 parent cb76cd5 commit 69a9e1b
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ public enum class SmithyBusinessMetric(public override val identifier: String) :
* Emits a business metric if the current [Attributes] instance is of type [ExecutionContext].
*/
@InternalApi
public fun Attributes.emitBusinessMetric(metric: BusinessMetric): Unit =
when (this) {
is ExecutionContext -> this.emitBusinessMetric(metric)
else -> throw UnsupportedOperationException("Business metric emission is supported only for attributes of type 'execution context'")
}
public fun Attributes.emitBusinessMetric(metric: BusinessMetric) {
if (this is ExecutionContext) this.emitBusinessMetric(metric)
}

0 comments on commit 69a9e1b

Please sign in to comment.