Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 3fcc8fa

Browse files
author
Matt Loring
committed
Warn if malformed source-contexts is found
1 parent a782875 commit 3fcc8fa

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/debuglet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Debuglet.prototype.start = function() {
102102

103103
that.logger_.info('Unique ID for this Application: ' + id);
104104

105-
that.debugletApi_.init(id, function(err) {
105+
that.debugletApi_.init(id, that.logger_, function(err) {
106106
if (err) {
107107
that.logger_.error('Unable to initialize the debuglet api' +
108108
' -- disabling debuglet', err);

lib/debugletapi.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,10 @@ function DebugletApi() {
5858
* that it can be uniquely identified on the server.
5959
* @param {!string} uid unique identifier for the version of source loaded
6060
* in the client
61+
* @param {Logger} logger a logger
6162
* @param {!function(?Error)} callback
6263
*/
63-
DebugletApi.prototype.init = function(uid, callback) {
64+
DebugletApi.prototype.init = function(uid, logger, callback) {
6465
var that = this;
6566
that.uid_ = uid;
6667
that.nextWaitToken_ = null;
@@ -76,7 +77,7 @@ DebugletApi.prototype.init = function(uid, callback) {
7677
try {
7778
that.sourceContext_ = JSON.parse(data);
7879
} catch (e) {
79-
// TODO: log a warning.
80+
logger.warn('Malformed source-contexts.json file.');
8081
// But we keep on going.
8182
}
8283
callback(null);

test/test-debugletapi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('Debuglet API', function() {
4848
});
4949

5050
it('should acquire the project number during init', function(done) {
51-
debugletapi.init('uid123', function(err) {
51+
debugletapi.init('uid123', { warn: function() {} }, function(err) {
5252
assert(!err);
5353
done();
5454
});

0 commit comments

Comments
 (0)