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

Commit

Permalink
Warn if malformed source-contexts is found
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Loring committed Jan 14, 2016
1 parent a782875 commit 3fcc8fa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/debuglet.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Debuglet.prototype.start = function() {

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

that.debugletApi_.init(id, function(err) {
that.debugletApi_.init(id, that.logger_, function(err) {
if (err) {
that.logger_.error('Unable to initialize the debuglet api' +
' -- disabling debuglet', err);
Expand Down
5 changes: 3 additions & 2 deletions lib/debugletapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ function DebugletApi() {
* that it can be uniquely identified on the server.
* @param {!string} uid unique identifier for the version of source loaded
* in the client
* @param {Logger} logger a logger
* @param {!function(?Error)} callback
*/
DebugletApi.prototype.init = function(uid, callback) {
DebugletApi.prototype.init = function(uid, logger, callback) {
var that = this;
that.uid_ = uid;
that.nextWaitToken_ = null;
Expand All @@ -76,7 +77,7 @@ DebugletApi.prototype.init = function(uid, callback) {
try {
that.sourceContext_ = JSON.parse(data);
} catch (e) {
// TODO: log a warning.
logger.warn('Malformed source-contexts.json file.');
// But we keep on going.
}
callback(null);
Expand Down
2 changes: 1 addition & 1 deletion test/test-debugletapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Debuglet API', function() {
});

it('should acquire the project number during init', function(done) {
debugletapi.init('uid123', function(err) {
debugletapi.init('uid123', { warn: function() {} }, function(err) {
assert(!err);
done();
});
Expand Down

0 comments on commit 3fcc8fa

Please sign in to comment.