[🍒]fix: remove error stack trace from validation failures#358
Conversation
There was a problem hiding this comment.
Code Review
This pull request removes calls to .withStacktrace(e.getStackTrace()) when adding failures to the FailureCollector across several files. The review feedback suggests throwing the collected exception immediately in validateCompoundFields to halt validation when a connection failure occurs, and fixing a minor grammatical typo in an error message.
| collector.addFailure( | ||
| String.format("Cannot establish connection to Salesforce to describe SObject: '%s' with error %s", | ||
| sObjectName, errorMessage), null) | ||
| .withStacktrace(e.getStackTrace()); | ||
| sObjectName, errorMessage), null); |
There was a problem hiding this comment.
When a connection exception occurs while describing the SObject, we should immediately throw the collected exception to stop the validation process. Continuing validation when the connection is down can lead to redundant connection attempts and duplicate error messages in subsequent validation steps (such as validatePKChunk).
collector.addFailure(
String.format("Cannot establish connection to Salesforce to describe SObject: '%s' with error %s",
sObjectName, errorMessage), null);
throw collector.getOrThrowException();| collector.addFailure(String.format("There was issue communicating with Salesforce due to error: %s", message), | ||
| null).withStacktrace(e.getStackTrace()); | ||
| null); |
There was a problem hiding this comment.
Fix a minor grammatical typo in the error message: 'There was issue' should be 'There was an issue'.
| collector.addFailure(String.format("There was issue communicating with Salesforce due to error: %s", message), | |
| null).withStacktrace(e.getStackTrace()); | |
| null); | |
| collector.addFailure(String.format("There was an issue communicating with Salesforce due to error: %s", message), | |
| null); |
During configuration validation in
SalesforceSourceConfigandSalesforceConnectionUtil, attaching a Java exception stack trace (.withStacktrace()) to validation failures caused the hosting runtime (Connectors Service) to classify user configuration errors as internal system faults.Removing
.withStacktrace()consistently across these validation call sites ensures the runtime correctly treats configuration failures as standard user errors, successfully propagating exact Salesforce error messages and error IDs to the client.This stack trace was exposing a lot of user information which is not required to debug or get the root cause of the issue.