Skip to content

logging: throw when a circular reference is used in an entry#1664

Merged
callmehiphop merged 2 commits intogoogleapis:masterfrom
stephenplusplus:spp--1354
Oct 5, 2016
Merged

logging: throw when a circular reference is used in an entry#1664
callmehiphop merged 2 commits intogoogleapis:masterfrom
stephenplusplus:spp--1354

Conversation

@stephenplusplus
Copy link
Contributor

Fixes #1354

Before

var entry = {
  val: true
};
entry.circularReference = entry;

var entry = log.entry(resource, circularReference);

log.write(entry, ...);
RangeError: Maximum call stack size exceeded
  ... Long stack trace ...

After

var entry = {
  val: true
};
entry.circularReference = entry;

var entry = log.entry(resource, circularReference);

log.write(entry, ...);
Error: The JSON data for this entry has a circular reference.

@stephenplusplus stephenplusplus added the api: logging Issues related to the Cloud Logging API. label Oct 3, 2016
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 3, 2016
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 8ce0a2c on stephenplusplus:spp--1354 into 009bc99 on GoogleCloudPlatform:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 8f0f942 on stephenplusplus:spp--1354 into 009bc99 on GoogleCloudPlatform:master.

* @private
*/
Entry.prototype.toJSON = function() {
if (is.object(this.data) && isCircular([this.data])) {

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: logging Issues related to the Cloud Logging API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants