From 88b8528aafbec2fadb80d71f7e010e6e9d5510fd Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 17 Sep 2015 13:42:08 -0700 Subject: [PATCH] [Entanglement] Log a warning on cycle detection nasa/openmctweb#84 --- .../src/services/LocatingObjectDecorator.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/platform/entanglement/src/services/LocatingObjectDecorator.js b/platform/entanglement/src/services/LocatingObjectDecorator.js index 1993c9cc94..6fde642ee0 100644 --- a/platform/entanglement/src/services/LocatingObjectDecorator.js +++ b/platform/entanglement/src/services/LocatingObjectDecorator.js @@ -69,9 +69,18 @@ define( } return objectService.getObjects([id]).then(function (objects) { - return exclude[id] ? - objects[id] : // Don't loop indefinitely. - attachContextForLocation(objects[id]); + if (exclude[id]) { + $log.warn([ + "LocatingObjectDecorator detected a cycle", + "while attempted to define a context for", + id + ";", + "no context will be added and unexpected behavior", + "may follow." + ].join(" ")); + return objects[id]; + } + + return attachContextForLocation(objects[id]); }); }