Skip to content

Commit

Permalink
Fixes #128 for all errors (#138)
Browse files Browse the repository at this point in the history
Adding try/catch around @angular/language-service calls to avoid output window opening on its own.
  • Loading branch information
DBosley authored and chuckjaz committed Aug 4, 2017
1 parent acae7ea commit 88f2bd1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/src/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3035,7 +3035,15 @@ export class LineLeaf implements LineCollection {
function logServiceTimes(logger: Logger, service: ng.LanguageService): ng.LanguageService {
function time<T>(name: string, cb: () => T): T {
const start = Date.now();
const result = cb();
let result: T = null;
try{
result = cb();
} catch (error) {
logger.msg(
`Error for ${name}:\n` +
` ${error.stack || error}`
);
}
logger.msg(`${name}: ${Date.now() - start}ms`);
return result;
}
Expand Down

0 comments on commit 88f2bd1

Please sign in to comment.