if (e.getCause() instanceof InstantiationException) {
throw new DefinitionException(BeanLogger.LOG.proxyInstantiationFailed(this), e.getCause());
} else if (e.getCause() instanceof IllegalAccessException) {
throw new DefinitionException(BeanLogger.LOG.proxyInstantiationBeanAccessFailed(this), e.getCause());
} else {
throw new WeldException(e.getCause());
}
}
((ProxyObject) proxy).setHandler(new ProxyMethodHandler(contextId, beanInstance, bean));
return proxy;
}