Skip to content

Commit

Permalink
Merge pull request InsertKoinIO#1166 from Pwootage/improve-scoped-ins…
Browse files Browse the repository at this point in the history
…tance-error

Add BeanDefinition to ScopedInstance error message
  • Loading branch information
arnaudgiuliani authored Nov 17, 2021
2 parents 23e165f + a4b14f6 commit e9bd0b2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ScopedInstanceFactory<T>(beanDefinition: BeanDefinition<T>) :
override fun create(context: InstanceContext): T {
return if (values[context.scope.id] == null) {
super.create(context)
} else values[context.scope.id] ?: error("Scoped instance not found for ${context.scope.id}")
} else values[context.scope.id] ?: error("Scoped instance not found for ${context.scope.id} in $beanDefinition")
}

override fun get(context: InstanceContext): T {
Expand All @@ -54,7 +54,7 @@ class ScopedInstanceFactory<T>(beanDefinition: BeanDefinition<T>) :
values[context.scope.id] = create(context)
}
}
return values[context.scope.id] ?: error("Scoped instance not found for ${context.scope.id}")
return values[context.scope.id] ?: error("Scoped instance not found for ${context.scope.id} in $beanDefinition")
}

override fun dropAll(){
Expand Down

0 comments on commit e9bd0b2

Please sign in to comment.