Skip to content

Better error handling when retrieving Avro schemas from registry#16684

Merged
abhishekrb19 merged 3 commits intoapache:masterfrom
abhishekrb19:better_error_handling_avro_decoder
Jul 2, 2024
Merged

Better error handling when retrieving Avro schemas from registry#16684
abhishekrb19 merged 3 commits intoapache:masterfrom
abhishekrb19:better_error_handling_avro_decoder

Conversation

@abhishekrb19
Copy link
Copy Markdown
Contributor

@abhishekrb19 abhishekrb19 commented Jul 2, 2024

Currently, when retrieving an Avro schema from the registry and if the request fails with an IOException or a RestClientException, we bubble this generic error up to the user:

"Failed to fetch Avro schema id[233323] from registry. Check if the schema exists in the registry. Otherwise it
could mean that there is malformed data in the stream or data that doesn't conform to the schema"
specified."

However, this error message is misleading in cases where the server is throwing unauthorized/forbidden error codes via RestClientException. So now we handle IOException and RestClientException separately so that we can bubble up more specific errors rather than the common template.

Added unit tests for the change and also cleaned up test annotations @Test(expected = ParseException.class) by adding better tests assertions.

This PR has:

  • been self-reviewed.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.

… error.

- Add tests
- Clean up the tests; remove the legacy expected exception pattern
- Better test assertions
Copy link
Copy Markdown
Contributor

@amaechler amaechler left a comment

Choose a reason for hiding this comment

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

🐻 Thanks!

Copy link
Copy Markdown
Contributor

@zachjsh zachjsh left a comment

Choose a reason for hiding this comment

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

😎

@abhishekrb19 abhishekrb19 merged commit 35b9709 into apache:master Jul 2, 2024
@abhishekrb19 abhishekrb19 deleted the better_error_handling_avro_decoder branch July 2, 2024 23:48
@kfaraz kfaraz added this to the 31.0.0 milestone Oct 4, 2024
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.

4 participants