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

bug: Handle NoClassDefFoundError when loading YAML recipes with missing recipe dependencies #4186

Merged
merged 4 commits into from
May 20, 2024

Conversation

bryceatmoderne
Copy link
Contributor

@bryceatmoderne bryceatmoderne commented May 10, 2024

What's changed?

Added logic to catch NoClassDefFoundError errors when loading YAML recipes with missing recipe dependencies

What's your motivation?

NoClassDefFoundError errors were previously not handled compromising troubleshooting.

Anything in particular you'd like reviewers to focus on?

Potential for regressed behaviour.

Anyone you would like to review specifically?

@timtebeek

Have you considered any alternatives or workarounds?

No

Any additional context

No

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Thanks for taking this on! I take it you've tested this particular scenario then as well?

@timtebeek timtebeek added the bug Something isn't working label May 10, 2024
@timtebeek
Copy link
Contributor

Had another look; when I modify the test case here to use an invalid class, it seems we're not entering the new catch block where I had expected that:

image

Also note that the new catch block is only added for Yaml resources that contain more than one document (or at least a --- separator), whereas it might be quite common to find resources without such a block and handle missing classes there as well.

Perhaps we should still add a test if possible to ensure we're catching in the right place and not missing certain cases.

@bryceatmoderne
Copy link
Contributor Author

bryceatmoderne commented May 13, 2024

Perhaps we should still add a test if possible to ensure we're catching in the right place and not missing certain cases.

I've added exception handling for the String recipeData case. I've also added unit testing as suggested. The tests validate the behaviour when a NoClassDefFoundError is thrown when attempting to instantiate a recipe, however it does so in a contrived manner that is not analogous to how the Moderne customer encountered it.

@bryceatmoderne bryceatmoderne merged commit d6417f2 into main May 20, 2024
1 check passed
@bryceatmoderne bryceatmoderne deleted the handle-NoClassDefFoundError-on-yaml-recipe-load branch May 20, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants