summaryrefslogtreecommitdiffstats
path: root/container-di
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2018-03-02 14:58:26 +0100
committergjoranv <gv@oath.com>2018-03-02 14:58:26 +0100
commite066c08356d97d73ab3a6af625fc4f00b15bc791 (patch)
tree7afd968110d9dabdd021a4c6df49c16e53ed7f21 /container-di
parentafb27dd97e5458eb32c25b86c52dc9c28bb9b672 (diff)
Improve error message when a component is trying to set its id.
Diffstat (limited to 'container-di')
-rw-r--r--container-di/src/main/scala/com/yahoo/container/di/componentgraph/core/ComponentNode.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/container-di/src/main/scala/com/yahoo/container/di/componentgraph/core/ComponentNode.scala b/container-di/src/main/scala/com/yahoo/container/di/componentgraph/core/ComponentNode.scala
index 4261b874330..cc1745d6e35 100644
--- a/container-di/src/main/scala/com/yahoo/container/di/componentgraph/core/ComponentNode.scala
+++ b/container-di/src/main/scala/com/yahoo/container/di/componentgraph/core/ComponentNode.scala
@@ -113,7 +113,9 @@ class ComponentNode(componentId: ComponentId,
private def initId(component: AnyRef) = {
def checkAndSetId(c: AbstractComponent) {
if (c.hasInitializedId && c.getId != componentId )
- throw new IllegalStateException("Component with id '" + componentId + "' has set a conflicting component id: '" + c.getId + "'")
+ throw new IllegalStateException(
+ s"Component with id '$componentId' is trying to set its component id explicitly: '${c.getId}'. " +
+ "This is not allowed, so please remove any call to super() in your component's constructor.")
c.initId(componentId)
}