Skip to content

Commit

Permalink
Merge pull request #23 from Jalle19/syntax-error
Browse files Browse the repository at this point in the history
Rename onSyntaxError to onParserError
  • Loading branch information
Jalle19 authored Oct 23, 2016
2 parents 99235d3 + 7c5f879 commit 3db5ea3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions libs/sources.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var sources;
* @type type
*/
var onSourceChange;
var onSyntaxError;
var onParserError;
var onLoad ;

/**
Expand All @@ -29,10 +29,10 @@ var onLoad ;
* @param callback
* @returns {undefined}
*/
var load = function(_filename, cbonSourceChange, cbonSyntaxError, cbonLoad) {
var load = function(_filename, cbonSourceChange, cbonParserError, cbonLoad) {
filename = _filename;
onSourceChange = cbonSourceChange;
onSyntaxError = cbonSyntaxError;
onParserError = cbonParserError;
onLoad = cbonLoad;

_load();
Expand Down Expand Up @@ -78,9 +78,8 @@ var _load = function() {
try {
var newSources = JSON.parse(fs.readFileSync(filename, 'utf8'));
}
catch (SyntaxError)
{
onSyntaxError();
catch (e) {
onParserError(e);
return;
}

Expand Down
6 changes: 3 additions & 3 deletions node-ffmpeg-mpegts-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ var onSourceChange = function() {
winston.info('Source definitions have changed, reloading ...');
};

var onSyntaxError = function() {
winston.info('Unable to read source definitions, JSON is malformed');
var onParserError = function(error) {
winston.info('Unable to read source definitions: %s', error.toString());
};

var onLoad = function(numSources) {
Expand All @@ -62,7 +62,7 @@ var onLoad = function(numSources) {

var sourceDefinitions = sources.load(argv.sources,
onSourceChange,
onSyntaxError,
onParserError,
onLoad);

/**
Expand Down

0 comments on commit 3db5ea3

Please sign in to comment.