Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide actionable error message when Provider in RESTEasy Reactive isn't a bean #19829

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,28 @@ public String toString() {

@Override
public BeanInstance<T> createInstance() {
BeanContainer.Instance<T> instance = factory.create();
return new BeanInstance<T>() {
@Override
public T getInstance() {
return instance.get();
BeanContainer.Instance<T> instance;
try {
instance = factory.create();
return new BeanInstance<T>() {
@Override
public T getInstance() {
return instance.get();
}

@Override
public void close() {
instance.close();
}
};
} catch (Exception e) {
if (factory.getClass().getName().contains("DefaultInstanceFactory")) {
throw new IllegalArgumentException(
"Unable to create class '" + targetClassName
+ "'. To fix the problem, make sure this class is a CDI bean.",
e);
}

@Override
public void close() {
instance.close();
}
};
throw e;
}
}
}