-
Notifications
You must be signed in to change notification settings - Fork 295
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
Feature/error handling #2271
base: master
Are you sure you want to change the base?
Feature/error handling #2271
Conversation
… feature/error_handling_dynamodb
…z-Akshay/aws-athena-query-federation into feature/error-handling
… feature/error_handling_elasticsearch
…ift-snowflake' into feature/error_handling_all
} | ||
else if (response.getActiveShards() == 0) { | ||
throw new RuntimeException("There are no active shards for index (" + index + ")."); | ||
throw new AthenaConnectorException("There are no active shards for index (" + index + ").", new ErrorDetails().withErrorCode(FederationSourceErrorCode.InternalServiceException.toString())); | ||
} | ||
else if (response.getStatus() == ClusterHealthStatus.RED) { |
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.
How are we handling access denied?
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.
AwsRestHighLevelClient only returns the client. the client will be returning a response in ElasticsearchMetadataHandler. so I think that will throw access denied on the metadata handler class as there is not any exclusive exception thrown.
} | ||
|
||
return domainMap; | ||
} | ||
catch (Exception error) { | ||
throw new RuntimeException("Unable to create domain map: " + error.getMessage(), error); |
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.
Why would this error occur?
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.
Removed this. As it was present there already so changed only exception.
@@ -129,13 +132,13 @@ private Map<String, String> getDomainMapFromAmazonElasticsearch() | |||
} | |||
|
|||
if (domainMap.isEmpty()) { | |||
throw new RuntimeException("Amazon Elasticsearch Service has no domain information for user."); | |||
throw new AthenaConnectorException("Amazon Elasticsearch Service has no domain information for user.", new ErrorDetails().withErrorCode(FederationSourceErrorCode.EntityNotFoundException.toString())); |
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 is more an invalid input?
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.
Replaced.
@@ -153,20 +156,20 @@ private Map<String, String> getDomainMapFromAmazonElasticsearch() | |||
private Map<String, String> getDomainMapFromEnvironmentVar(String domainMapping) | |||
{ | |||
if (domainMapping == null || domainMapping.isEmpty()) { | |||
throw new RuntimeException("Unable to create domain map: Empty or null value found in DomainMapping."); | |||
throw new AthenaConnectorException("Unable to create domain map: Empty or null value found in DomainMapping.", new ErrorDetails().withErrorCode(FederationSourceErrorCode.EntityNotFoundException.toString())); |
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 is more an invalid input
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.
updated.
} | ||
Map<String, String> domainMap; | ||
try { | ||
domainMap = domainSplitter.split(domainMapping); | ||
} | ||
catch (Exception error) { | ||
// Intentional obfuscation of error message as it may contain sensitive info (e.g. username/password). | ||
throw new RuntimeException("Unable to create domain map: DomainMapping Parsing error."); | ||
throw new AthenaConnectorException("Unable to create domain map: DomainMapping Parsing error.", new ErrorDetails().withErrorCode(FederationSourceErrorCode.InternalServiceException.toString())); |
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 is also an invalid input
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.
updated.
} | ||
|
||
if (domainMap.isEmpty()) { | ||
// Intentional obfuscation of error message: domainMapping contains sensitive info (e.g. username/password). | ||
throw new RuntimeException("Unable to create domain map: Invalid DomainMapping value."); | ||
throw new AthenaConnectorException("Unable to create domain map: Invalid DomainMapping value.", new ErrorDetails().withErrorCode(FederationSourceErrorCode.InvalidResponseException.toString())); |
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.
why did invalid response?
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.
updated to InvalidInput
Can we break this pull request into individual connector and sdk? This is a huge pull request and hard to review |
@yipez-spec Below are the PRs raised for individual moduls: I have incorporated the review feedback given by @aaronsven . Please review the above PRs. |
Issue #, if available:
#2256 error handling improvement
Description of changes:
This PR contains error handling changes for connectors with athena-federation-sdk and athena-jdbc :
Snowflake
Redshift
OpenSearch
DynamoDB
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.