Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Won't Fix
-
scr-2.0.14
-
None
-
None
Description
For Factory Components when ComponentFactory.newInstance() is called and this leads to a failure of the component activate() method the exception that method throws is not propagated to the caller of ComponentFactory.newInstance().
Although the DS spec does not seem to require that this error propagation is done nevertheless this seems like a natural thing to expect on one hand and on another it can be extremely useful for certain use cases.
The use case that exposed this is:
- A server offers the uses means to create service components
- The components are created from data received in the rest request - not from configuration.
- The users expect synchronous reply of success or failure. In case of failure the users must get a meaningful error message.
- The activate() method validates the configuration and fails with an exception if invalid.
- The exception is retrieved from ComponentException.getCause() and the error is sent back in the rest reply.