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

[PLUGIN-1773] Add a check for error 71005 #49

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

psainics
Copy link
Contributor

@psainics psainics commented Apr 1, 2024

Add a check for soap error 71005

Jira : PLUGIN-1773

Description

Add a check for error code 71005 (Violation of PRIMARY KEY constraint)

@psainics psainics added the build label Apr 1, 2024
@psainics
Copy link
Contributor Author

psainics commented Apr 1, 2024

E2E will be updated in a seprate PR, unrelated to this change !

// super hacky to check the error message... but there is no better way
// error code 2 and 71005 are "Primary key violation"
return row.getStatus() == ETResult.Status.ERROR && row.getErrorCode() != null &&
(row.getErrorCode() == 2 || row.getErrorCode() == 71005) && row.getErrorMessage() != null &&
Copy link

@sahusanket sahusanket Apr 3, 2024

Choose a reason for hiding this comment

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

Minor nit :

Create a class level variable set of error codes like

import com.google.common.collect.ImmutableSet;
Set<Integer> PK_ERROR_CODES = ImmutableSet.of(2, 71005);

and use:
PK_ERROR_CODES.contains(row.getErrorCode());

This will help us add new error codes easily in future and bit more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, that's better !
I have updated this 👍

Copy link

@sahusanket sahusanket left a comment

Choose a reason for hiding this comment

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

added a minor NIT.
Please test after making the changes, Approved.

@psainics psainics merged commit da72150 into data-integrations:develop Apr 4, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants