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

SNOW-1737830 log the original error with JSON.stringify differently (default doesn't log non-enumerable properties, thus in Error: none) #944

Merged
2 changes: 1 addition & 1 deletion lib/connection/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
await this.heartbeatAsync();
return true;
} catch (e) {
Logger.getInstance().debug('Connection[id: %s] - heartbeat failed: %s', this.getId(), JSON.stringify(e, Util.getCircularReplacer()));
Logger.getInstance().debug('Connection[id: %s] - heartbeat failed: %s', this.getId(), JSON.stringify(e, Object.getOwnPropertyNames(e)));

Check warning on line 200 in lib/connection/connection.js

View check run for this annotation

Codecov / codecov/patch

lib/connection/connection.js#L200

Added line #L200 was not covered by tests
return false;
}
};
Expand Down
4 changes: 2 additions & 2 deletions lib/services/large_result_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ function LargeResultSetService(connectionConfig, httpClient) {
// err happens on timeouts and response is passed when server responded
if (err || isUnsuccessfulResponse(response)) {
// if we're running in DEBUG loglevel, probably we want to see the full error too
const logErr = err ? JSON.stringify(err, Util.getCircularReplacer())
: `status: ${JSON.stringify(response.status)} ${JSON.stringify(response.statusText)}`
const logErr = err ? JSON.stringify(err, Object.getOwnPropertyNames(err))
: `status: ${JSON.stringify(response.status)} ${JSON.stringify(response.statusText)}`
+ ` headers: ${JSON.stringify(response.headers)}`;
Logger.getInstance().debug('Encountered an error when getting data from cloud storage: ' + logErr);
// if we haven't exceeded the maximum number of retries yet and the
Expand Down
2 changes: 1 addition & 1 deletion lib/services/sf.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ function StateAbstract(options) {
if (err) {
// if we're running in DEBUG loglevel, probably we want to see the full error instead
Logger.getInstance().debug('Encountered an error when sending the request. Details: '
+ JSON.stringify(err, Util.getCircularReplacer()));
+ JSON.stringify(err, Object.getOwnPropertyNames(err)));

err = Errors.createNetworkError(
ErrorCodes.ERR_SF_NETWORK_COULD_NOT_CONNECT, err);
Expand Down
Loading