Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Seed error reporting improvements #87

Merged
merged 4 commits into from
Jun 26, 2018

Conversation

stefanverhoeff
Copy link
Collaborator

Several improvements to make sure the Seed job fails on errors related to parent folders, and make error reporting more clear.

return item
}
else {
println " WARNING: parent ${parentName} is not a folder but of type '${item?.class}''"
Copy link
Contributor

Choose a reason for hiding this comment

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

item?: the null-safe operator is not required here because you checked item == null before.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

if (item == null) {
println " WARNING: parent folder ${parentName} not found"
return null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move the else if to this line for consistency, same with the else below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@@ -43,7 +43,7 @@ def createItem(ItemGroup parent, String name, FilePath file) {
parent.createProjectFromXML(name, file.read())
createdItems++
} else {
println " Could not create project in parent of type ${parent.class}"
throw new RuntimeException("Parent is not a folder type ModifiableViewGroup but of type '${parent?.class}'")
Copy link
Contributor

Choose a reason for hiding this comment

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

Commit message: "...are created..."
These exceptions will be catched in updateJobs so they will not make the job fail.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I left the typo in the commit message so I don't need to force push the branch. Let me know what you prefer.

Yes the exception will be caught, but then the totalFailures var will be incremented and this raises an exception after all jobs are updated.

Copy link
Contributor

@mnonnenmacher mnonnenmacher Jun 25, 2018

Choose a reason for hiding this comment

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

I prefer the Gerrit-like rebase workflow because it creates a nicer history (I'm not a fan of PR fixup commits because they leave a broken state in the history), so force pushing the PR branch is fine.

@@ -42,6 +42,8 @@ def createItem(ItemGroup parent, String name, FilePath file) {
if (parent instanceof ModifiableViewGroup) {
parent.createProjectFromXML(name, file.read())
createdItems++
} else if (parent == null) {
throw new RuntimeException("Parent is null. This happens when the parent folder could not get created, which can happen if a job with the name of the parent folder already exists. To solve this rename the job or the parent folder.")
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Please stick to the 120 character line length limit.
  • "if a job with the name of the parent folder already exists": This is only one of the possible reasons, maybe add "which can happen for example..." to avoid confusion in case there was another problem.
  • If you add the null check the null-safe operator should be removed from parent? below.

@@ -59,6 +61,8 @@ def createView(ItemGroup parent, String name, FilePath file) {
if (parent instanceof ModifiableViewGroup) {
((ModifiableViewGroup) parent).addView(View.createViewFromXML(name, file.read()))
createdViews++
} else if (parent == null) {
throw new RuntimeException("Parent is null. This happens when the parent folder could not get created, which can happen if a job with the name of the parent folder already exists. To solve this rename the job or the parent folder.")
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Please stick to the 120 character line length limit.
  • "if a job with the name of the parent folder already exists": This is only one of the possible reasons, maybe add "which can happen for example..." to avoid confusion in case there was another problem.
  • If you add the null check the null-safe operator should be removed from parent? below.

- Mark exception output clearly with ERROR
- Indent summary so it stands out in console output view
This helps diagnose issues when Seed job fails.
Make sure the Seed job goes red in case not all
jobs are created as expected.
Make the error more clear in case a job exists with the
same name as a folder, and offer a possible solution.
@stefanverhoeff
Copy link
Collaborator Author

stefanverhoeff commented Jun 26, 2018

Fixes now rebased into original commits

@mnonnenmacher
Copy link
Contributor

Thanks @stefanverhoeff !

@mnonnenmacher mnonnenmacher merged commit 73077be into heremaps:master Jun 26, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants