-
Notifications
You must be signed in to change notification settings - Fork 219
Mapping bigquery errors to http status codes #2041
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
Open
adamallegro
wants to merge
14
commits into
master
Choose a base branch
from
TANGO-3103
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
948b74a
TANGO-3103 : Permanent errors of bigquery-consumer mapped to 4xx http…
adamallegro a0c38b7
TANGO-3103 : Added logging of error and statusCode
adamallegro f41be80
TANGO-3103 : Added custom http status code in error handling as well
adamallegro cb57148
Merge branch 'master' into TANGO-3103
adamallegro 8aa085a
TANGO-3103 : Fixes after merge
adamallegro 41b0a77
TANGO-3103 : Default 500 when any other error will appear
adamallegro 9e09a33
TANGO-3103 : Removed unnecessary loggings
adamallegro 3feaf26
TANGO-3103 : Removed unused logger field
adamallegro 76cf7bc
TANGO-3103 : Reformatted code
adamallegro 65c8473
TANGO-3103 : Reformatted code v2
adamallegro b5144ff
TANGO-3103 : Reformatted code v3
adamallegro a1a359f
TANGO-3103: Potential fix for pull request finding
adamallegro bba076b
Merge branch 'master' into TANGO-3103
adamallegro 0362ed4
TANGO-3103 : Applied review changes
adamallegro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../hermes/consumers/consumer/sender/googlebigquery/GoogleBigQueryFailedAppendException.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package pl.allegro.tech.hermes.consumers.consumer.sender.googlebigquery; | ||
|
|
||
| import com.google.cloud.bigquery.storage.v1.Exceptions; | ||
| import java.util.Map; | ||
|
|
||
| public class GoogleBigQueryFailedAppendException extends RuntimeException { | ||
| public GoogleBigQueryFailedAppendException(Exceptions.AppendSerializtionError cause) { | ||
| super(cause.getMessage(), cause); | ||
| } | ||
|
|
||
| @Override | ||
| public String getMessage() { | ||
| Exceptions.AppendSerializtionError cause = | ||
| ((Exceptions.AppendSerializtionError) this.getCause()); | ||
|
adamallegro marked this conversation as resolved.
|
||
| StringBuilder message = | ||
| new StringBuilder( | ||
| String.format( | ||
| "GoogleBigQuery Subscription has failed to append rows to stream %s", | ||
| cause.getStreamName())); | ||
| message.append(String.format("\n%s", super.getMessage())); | ||
| if (cause.getRowIndexToErrorMessage() != null) { | ||
| for (Map.Entry<Integer, String> entry : cause.getRowIndexToErrorMessage().entrySet()) { | ||
| message.append( | ||
| String.format( | ||
| "\nGoogleBigQuery Subscription has failed because of %s", entry.getValue())); | ||
| } | ||
| } | ||
| return message.toString(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can return "int"
nit: what's "permanent" in that context? we can skip it in the function name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.