Open lacasseio opened 11 months ago
Thank you for providing a valid report.
The issue is in the backlog of the relevant team and is prioritized by them.
I have submitted a PR to resolve this https://github.com/gradle/gradle/pull/30916
We use an InvalidUserCodeException
, which is contextual, instead of a GradleException
.
Though this only feels like a band-aid to me. There are 181 calls to create GradleException
instances, so this is probably not the only place where we are failing to print context to the console.
Do you know why all exceptions are not treated as contextual? I feel like it is too easy to not use a contextual exception, or to write a new exception type and fail to mark it as contextual.
Current Behavior
When declaring a dependency on
ResolvableConfiguration
, throughConfiguration#getDependencies()
, the error should show in the "what went wrong" is incomplete, causing confusion to the user.Expected Behavior
When declaring a dependency on
ResolvableConfiguration
, either throughConfiguration#getDependencies()
orDependencyHandler
, the error should show in the "what went wrong":Context (optional)
This is a classic mistake of a new Gradle developer of not declaring the exception thrown as
Contextual
. Note that "you can see the full stack through build scans" is not an acceptable solution.Steps to Reproduce
Running
help
on the following build script will showcase the issue:Gradle version
8.5-rc-1 (but most likely affects all previous relevant Gradle version)
Build scan URL (optional)
No response
Your Environment (optional)
No response