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

client: add info from http response to client exception #2486

Conversation

davidjgoss
Copy link
Contributor

Problem

When using the HttpTransport with the Java client, if the receiving service (Marquez or whatever) responds with a non-2xx status then an OpenLineageClientException is thrown with a descriptive message. The consuming code may want to do something different with that exception depending on the response - e.g. we might retry the operation for a 502 but not for a 400. Currently this information has to be parsed out of the exception message.

Solution

This PR adds HttpTransportResponseException, a subclass of OpenLineageClientException that includes fields for status code and body - this is what is now thrown in the event of a non-2xx response. Note that other exception-raising scenarios like timeouts and bad config will behave as previously. Also, the message on the exception remains the same for backwards compatibility.

One-line summary:

Adds the status code and body as properties on the thrown exception when a non-success response is encountered in the HTTP transport.

Checklist

  • You've signed-off your work
  • Your pull request title follows our guidelines
  • Your changes are accompanied by tests (if relevant)
  • Your change contains a small diff and is self-contained
  • You've updated any relevant documentation (if relevant)
  • Your comment includes a one-liner for the changelog about the specific purpose of the change (if necessary)
  • You've versioned the core OpenLineage model or facets according to SchemaVer (if relevant)
  • You've added a header to source files (if relevant)

SPDX-License-Identifier: Apache-2.0
Copyright 2018-2023 contributors to the OpenLineage project

@boring-cyborg boring-cyborg bot added the area:client/java openlineage-java label Mar 3, 2024
@davidjgoss davidjgoss force-pushed the feat/client-java-http-exception branch from 1f3aae4 to 138e8a4 Compare March 3, 2024 09:06
Copy link
Contributor

@pawel-big-lebowski pawel-big-lebowski left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Minor: wouldn't HttpTransportResponseException constructor be a better place to create message?

@davidjgoss
Copy link
Contributor Author

davidjgoss commented Mar 4, 2024

Minor: wouldn't HttpTransportResponseException constructor be a better place to create message?

Good point, have done that.

Signed-off-by: David Goss <david.goss@matillion.com>
@davidjgoss davidjgoss force-pushed the feat/client-java-http-exception branch from 138e8a4 to 35500a2 Compare March 4, 2024 08:59
@pawel-big-lebowski pawel-big-lebowski merged commit f920eb0 into OpenLineage:main Mar 5, 2024
39 checks passed
@davidjgoss davidjgoss deleted the feat/client-java-http-exception branch March 5, 2024 08:26
Ruihua98 pushed a commit to Ruihua98/OpenLineage that referenced this pull request Mar 15, 2024
Signed-off-by: David Goss <david.goss@matillion.com>
Signed-off-by: Ruihua Wang <ruihuawang@microsoft.com>
blacklight pushed a commit to blacklight/OpenLineage that referenced this pull request Apr 4, 2024
Signed-off-by: David Goss <david.goss@matillion.com>
Signed-off-by: Fabio Manganiello <fabio@manganiello.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:client/java openlineage-java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants