Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include throwable message in BeanInstanceCreationException #124

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -3,6 +3,10 @@ package org.koin.core.instance
import org.koin.core.bean.BeanDefinition
import org.koin.dsl.context.ParameterProvider
import org.koin.error.BeanInstanceCreationException
import java.io.PrintWriter
import java.io.StringWriter



/**
* Instance factory - handle objects creation against BeanRegistry
Expand Down Expand Up @@ -60,7 +64,10 @@ class InstanceFactory() {
return instance
} catch (e: Throwable) {
e.printStackTrace()
throw BeanInstanceCreationException("Can't create bean $def due to error :\n\t$e")
val sw = StringWriter()
e.printStackTrace(PrintWriter(sw))
val exceptionAsString = sw.toString()
throw BeanInstanceCreationException("Can't create bean $def due to error :\n\t$e; $exceptionAsString")
}
}

Expand Down