Skip to content

Commit

Permalink
Update ComponentInstanceImpl.hpp (#724)
Browse files Browse the repository at this point in the history
* Update ComponentInstanceImpl.hpp

Improve error message that is generated when an appropriate constructor isn't found for the Service Instance. 

Signed-off-by, The MathWorks, Inc. <pelliott@mathworks.com>
  • Loading branch information
pelliott-mathworks committed Sep 27, 2022
1 parent 4f18659 commit 23cf347
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,11 @@ class ComponentInstanceImpl final
{
static_assert(
std::is_default_constructible<C>::value,
"Default Constructor or Constructor with AnyMap input parameter "
"expected when injection is false. This error happens when an "
"appropriate constructor is not available or when the class being "
"validated is not a complete type.");
"An appropriate constructor was not found "
"and/or the service implementation does not implement all of the "
"service interface's methods. A default constructor or a constructor "
"with an AnyMap input parameter for the configuration properties is "
"required when inject-references is false. ");
return nullptr;
}

Expand All @@ -442,9 +443,12 @@ class ComponentInstanceImpl final
static_assert(
std::is_constructible<C,
const std::shared_ptr<CtorInjectedRefs>&...>::value,
"Suitable constructor not found for constructor injection. "
"This error happens when an appropriate constructor is not available "
"or when the class being validated is not a complete type.");
"An appropriate constructor was not found "
"and/or the service implementation does not implement all of the "
"service interface's methods. A constructor with service reference "
"input parameters or a constructor with an AnyMap input parameter for "
"configuration properties and service reference input parameters is "
"required when inject-references is true. ");
return nullptr;
}

Expand Down

0 comments on commit 23cf347

Please sign in to comment.