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

JENKINS-52744 Showing meaningful error when an environment variable i… #309

Merged
merged 6 commits into from Jan 10, 2019

Conversation

joseblas
Copy link
Contributor

…s not declared properly

  • JENKINS issue(s):
  • Description:
    • Using not existing environment variables in environment GString expression causes strange error message
  • Documentation changes:
    • Changing message error, no need for documentation update
  • Users/aliases to notify:
    • ...

@joseblas joseblas requested review from abayer and rsandell and removed request for abayer December 17, 2018 15:08
@joseblas joseblas changed the title [WIP] JENKINS-52744 Showing meaningful error when an environment variable i… JENKINS-52744 Showing meaningful error when an environment variable i… Dec 17, 2018
@joseblas joseblas requested a review from abayer December 17, 2018 15:08
@@ -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))
Copy link
Member

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.

Copy link
Contributor Author

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?

@abayer abayer merged commit ce298b7 into master Jan 10, 2019
@bitwiseman bitwiseman deleted the JENKINS-52744 branch November 4, 2019 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants