Skip to content

Commit

Permalink
Better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed Oct 28, 2009
1 parent e6ee2f3 commit 8ccd0bc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions impl/src/main/java/org/jboss/weld/servlet/ServletHelper.java
Expand Up @@ -34,10 +34,16 @@ public static BeanManagerImpl getModuleBeanManager(ServletContext ctx)
{
if (ctx == null)
{
throw new IllegalArgumentException("Must provide the Servlet Context");
throw new IllegalArgumentException("ServletContext is null");
}
BeanDeploymentArchive beanDeploymentArchive = Container.instance().deploymentServices().get(ServletServices.class).getBeanDeploymentArchive(ctx);
return Container.instance().beanDeploymentArchives().get(beanDeploymentArchive).getCurrent();
BeanManagerImpl beanManagerImpl = Container.instance().beanDeploymentArchives().get(beanDeploymentArchive);
if (beanManagerImpl == null)
{
throw new IllegalArgumentException("Unable to find BeanManager. BeanDeploymentArchive: " + beanDeploymentArchive + "; ServletContext: " + ctx);
}
// Actually we need the manager for the current activity
return beanManagerImpl.getCurrent();
}

}

0 comments on commit 8ccd0bc

Please sign in to comment.