-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Msiega/log unexpected fields #21922
Msiega/log unexpected fields #21922
Conversation
Airbyte Code Coverage
|
} | ||
} | ||
} else { | ||
throw new RuntimeException(String.format("Unexpected data in record: %s", data)); |
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.
is there a posibility to have a valid non object here?
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.
I mean it should not happen, but if that happen something is going to break in the code in the if
block, better to test and throw a more specific exception.
We could use a more specific error message though "Expecting object in record data, got '%s' instead" or something like this.
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.
(@malikdiarra you had a comment on the same block)
According to the Airbyte Protocol the data
property of a record message must be a JSON of object
type, so in theory no.
However, on second thought I don't think we should be throwing here in any case - that will basically crash the whole sync, and that's why we have the validation step (which doesn't throw, but rather builds a list of errors).
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.
This looks good to me. How easy is it to test this block of code before we release it?
} | ||
} | ||
} else { | ||
throw new RuntimeException(String.format("Unexpected data in record: %s", data)); |
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.
I mean it should not happen, but if that happen something is going to break in the code in the if
block, better to test and throw a more specific exception.
We could use a more specific error message though "Expecting object in record data, got '%s' instead" or something like this.
What
Log when we see fields that aren't in the catalog.
How