mirror of https://github.com/apache/cloudstack.git
framework/spring: throw RuntimeException when fail to start or load a module (#13186)
This commit is contained in:
parent
6227525c84
commit
288f9a9fd7
|
|
@ -73,7 +73,8 @@ public class CloudStackExtendedLifeCycle extends AbstractBeanCollector {
|
|||
try {
|
||||
lifecycle.start();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error on starting bean {} - {}", lifecycle.getName(), e.getMessage(), e);
|
||||
logger.error("Error on starting bean [{}] due to: {}", lifecycle.getName(), e);
|
||||
throw new CloudRuntimeException("Failed to start bean [" + lifecycle.getName() + "]");
|
||||
}
|
||||
|
||||
if (lifecycle instanceof ManagementBean) {
|
||||
|
|
|
|||
|
|
@ -112,10 +112,8 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
|
|||
logger.debug(String.format("Could not get module [%s] context bean.", moduleDefinitionName));
|
||||
}
|
||||
} catch (BeansException e) {
|
||||
logger.warn(String.format("Failed to start module [%s] due to: [%s].", moduleDefinitionName, e.getMessage()));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("module start failure of module [%s] was due to: ", moduleDefinitionName), e);
|
||||
}
|
||||
logger.error("Failed to start module [{}] due to: {}", def.getName(), e);
|
||||
throw new RuntimeException(String.format("Failed to start module [%s]", def.getName()));
|
||||
}
|
||||
} catch (EmptyStackException e) {
|
||||
logger.warn(String.format("Failed to obtain module context due to [%s]. Using root context instead.", e.getMessage()));
|
||||
|
|
@ -147,10 +145,8 @@ public class DefaultModuleDefinitionSet implements ModuleDefinitionSet {
|
|||
logger.debug("Failed to obtain module context: ", e);
|
||||
}
|
||||
} catch (BeansException e) {
|
||||
logger.warn(String.format("Failed to start module [%s] due to: [%s].", def.getName(), e.getMessage()));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(String.format("module start failure of module [%s] was due to: ", def.getName()), e);
|
||||
}
|
||||
logger.error("Failed to load module [{}] due to: {}", def.getName(), e);
|
||||
throw new RuntimeException(String.format("Failed to load module [%s]", def.getName()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue