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
JENKINS-52744 Showing meaningful error when an environment variable i… #309
Conversation
…s not declared properly
…s not declared properly
…s not declared properly
...on/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
Outdated
Show resolved
Hide resolved
…clared due to its value
@@ -455,7 +455,7 @@ class ModelInterpreter implements Serializable { | |||
"${k}=${v.call()}" | |||
}catch (NullPointerException e){ | |||
|
|||
throw new IllegalArgumentException(format("Invalid var declared in environment: %s", k)) | |||
throw new IllegalArgumentException(format("Invalid variable (%s) declared in environment; There are some problems with its value", k)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in practice, this is only going to show up if there's a reference to a non-existent variable in the value, right? Hence the NullPointerException
- so in that case, we could probably be more specific and say something like One or more variables in its value do not exist
?
Also, this should go in Messages.properties
so that it can be localized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to narrow that much the error, what if another issue comes up as NPE?
…s not declared properly