Skip to content

Conversation

@GaoSSR
Copy link
Contributor

@GaoSSR GaoSSR commented Dec 31, 2025

Fixes #10324

Signed-off-by: 高春晖 <18220699480@163.com>
enhanced.append("Failed to collect dependencies");

org.eclipse.aether.graph.Dependency root = request.getRoot();
if (root != null && root.getArtifact() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (root != null && root.getArtifact() != null) {
return if (root != null && root.getArtifact() != null) ? enhanceDependency() : enhanceDependencies(...);

could be extracted as dedicated branch/concern to provide cohesion over coupling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operators are harder to read

}
}

for (org.eclipse.aether.graph.Dependency dep : request.getDependencies()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be extracted as dedicated branch/concern to provide cohesion over coupling.

Suggested change
for (org.eclipse.aether.graph.Dependency dep : request.getDependencies()) {
return enhanceDependencies(...)

} catch (DependencyCollectionException e) {
throw new DependencyResolverException("Unable to collect dependencies", e);
String enhancedMessage = enhanceCollectionError(e, collectRequest);
throw new DependencyResolverException(enhancedMessage, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new DependencyResolverException(enhancedMessage, e);
throw new DependencyResolverException(enhanceCollectionError(e, collectRequest), e);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is

} catch (DependencyCollectionException e) {
throw new DependencyResolverException("Unable to collect dependencies", e);
String enhancedMessage = enhanceCollectionError(e, collectRequest);
throw new DependencyResolverException(enhancedMessage, e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine as is

enhanced.append("Failed to collect dependencies");

org.eclipse.aether.graph.Dependency root = request.getRoot();
if (root != null && root.getArtifact() != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ternary operators are harder to read

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MNG-8751] Bad error message when unresolved expressions exist in POM

3 participants