Class ModuleSetupRuntimeException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.opendaylight.infrautils.inject.ModuleSetupRuntimeException
-
- All Implemented Interfaces:
Serializable
public class ModuleSetupRuntimeException extends RuntimeException
Exception to throw from a static Dependency Inject Framework's "Wiring" class.Also used in
Lifecycle.init()
andLifecycle.destroy()
, because those methods are typically called from DI's Wiring classes (typically implicitly by a DI framework, and not hand-written Wiring code).For example, throw this from methods in a class implementing Guice's Module interface, or from methods annotated with Dagger's @Provides in a @Module class, which "may only throw unchecked exceptions". In particular, when you have to catch checked exceptions while creating objects, wrap them into this unchecked Exception.
When you use this Exception in a Dagger/Guice/etc. Module, you should probably write a simple test for the Module, just to verify it (alone) works at run-time (if there is a checked exception to catch, it probably initializes something that is non-trivial and could fail; so best to have a non-regression test for that Module).
- Author:
- Michael Vorburger
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ModuleSetupRuntimeException(Exception cause)
-
Method Summary
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
ModuleSetupRuntimeException
public ModuleSetupRuntimeException(Exception cause)
-
-