Skip to content

Commit

Permalink
Merge pull request #210 from bryan-m-hughes/timob-14098
Browse files Browse the repository at this point in the history
[TIMOB-14098] Added a check for callstack exceeded exceptions
  • Loading branch information
cb1kenobi committed Jun 4, 2013
2 parents 818355e + 00f92bc commit fdf7eb0
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions lib/CodeProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,26 +261,37 @@ function run(sourceInformation, options, plugins, logger, callback) {

Runtime.setLogger(logger);

init(sourceInformation, options, plugins);
try {
init(sourceInformation, options, plugins);

Runtime.on('enteredFile', function(e) {
Runtime.log('debug', 'Entering file ' + e.data.filename);
});
Runtime.on('enteredFile', function(e) {
Runtime.log('debug', 'Entering file ' + e.data.filename);
});

Runtime.fireEvent('projectProcessingBegin', 'Project processing is beginning');
Runtime.fireEvent('projectProcessingBegin', 'Project processing is beginning');

Runtime.log('info', 'Analyzing project');
results = processEntryPoint(sourceInformation.entryPoint);
Runtime.log('info', 'Analyzing project');
results = processEntryPoint(sourceInformation.entryPoint);

Runtime.log('info', 'Processing queued functions');
processQueuedFunctions();
Runtime.log('info', 'Processing queued functions');
processQueuedFunctions();

if (Runtime.options.processUnvisitedCode) {
Runtime.log('info', 'Processing unvisited code');
processUnvisitedCode();
}
if (Runtime.options.processUnvisitedCode) {
Runtime.log('info', 'Processing unvisited code');
processUnvisitedCode();
}

finalize();
finalize();
} catch(e) {
if (e instanceof RangeError && e.message === 'Maximum call stack size exceeded') {
console.error('node.js maximum call stack size exceeded. Increasing the stack size may allow the project to be fully analyzed');
} else {
console.error('Internal error ' + e.message + '. Please file a bug report at http://jira.appcelerator.org/');
if (e.stack) {
Runtime.log('debug', e.stack);
}
}
}

Runtime.log('info', 'Generating results');
Runtime.fireEvent('projectProcessingEnd', 'Project processing complete');
Expand Down

0 comments on commit fdf7eb0

Please sign in to comment.