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

Fixes #1846 by displaying a user-friendly error message instead of a stack trace on boot error #2199

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lakshmishreea122003
Copy link

Fixes issue(#1846) with configurator exception being thrown for unknown keys. Now logs the unknown keys and throws a more informative exception.

Your checklist for this pull request

🚨 Please review the guidelines for contributing to this repository.

  • [ X] Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • [X ] Ensure that the pull request title represents the desired changelog entry
  • [ X] Please describe what you did
  • [X ] Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

@@ -729,9 +729,10 @@ private static void invokeWith(Mapping entries, ConfiguratorOperation function)
unknownKeys.add(key);
}
});

Copy link
Member

Choose a reason for hiding this comment

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

Try removing the trailing spaces at L732.

…de.java

Co-authored-by: Kris Stern <krisstern@outlook.com>
@codecov
Copy link

codecov bot commented Jan 31, 2023

Codecov Report

Merging #2199 (50aa680) into master (aa06e58) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##             master    #2199   +/-   ##
=========================================
  Coverage     80.96%   80.97%           
  Complexity      843      843           
=========================================
  Files            72       72           
  Lines          2506     2507    +1     
  Branches        352      352           
=========================================
+ Hits           2029     2030    +1     
  Misses          365      365           
  Partials        112      112           
Impacted Files Coverage Δ
...a/io/jenkins/plugins/casc/ConfigurationAsCode.java 80.37% <100.00%> (+0.05%) ⬆️

Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

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

this will still show the stacktrace from what I can see.

@lakshmishreea122003
Copy link
Author

Sorry for the late response due to my exams. I felt code snippet in this PR provides a more user-friendly error message compared to the current code snippet, as it throws a ConfiguratorException with a message "Invalid Configuration. Please check your configuration and try again." that can be displayed and by logging the message in the sever level the stack trace would not be shown . If my assumption was wrong, please can you give me a clue as to how I can go ahead to work this issue in a better manner.

@timja
Copy link
Member

timja commented Feb 11, 2023

It's not the message itself that's the problem its the stacktrace.

The Jenkins core boot failure error message should have the option of suppressing the stacktrace, to fix this issue you would likely need to see where that error page is built in Jenkins core and make displaying the stacktrace optional in some way.

@lakshmishreea122003
Copy link
Author

I shall start working on this issue as per your advice.

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.

None yet

3 participants