Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-14098] Added a check for callstack exceeded exceptions #211

Merged
merged 2 commits into from
Jun 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 25 additions & 14 deletions lib/CodeProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,26 +267,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