| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.cmdline; | 5 library dart2js.cmdline; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
| 10 | 10 |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 exit(0); | 555 exit(0); |
| 556 } | 556 } |
| 557 | 557 |
| 558 void helpAndFail(String message) { | 558 void helpAndFail(String message) { |
| 559 help(); | 559 help(); |
| 560 print(''); | 560 print(''); |
| 561 fail(message); | 561 fail(message); |
| 562 } | 562 } |
| 563 | 563 |
| 564 void mainWithErrorHandler(Options options) { | 564 void mainWithErrorHandler(Options options) { |
| 565 new Future.sync(() => compilerMain(options)).catchError((exception) { | 565 runZonedExperimental(() => compilerMain(options), onError: (exception) { |
| 566 try { | 566 try { |
| 567 print('Internal error: $exception'); | 567 print('Internal error: $exception'); |
| 568 } catch (ignored) { | 568 } catch (ignored) { |
| 569 print('Internal error: error while printing exception'); | 569 print('Internal error: error while printing exception'); |
| 570 } | 570 } |
| 571 | 571 |
| 572 try { | 572 try { |
| 573 var trace = getAttachedStackTrace(exception); | 573 var trace = getAttachedStackTrace(exception); |
| 574 if (trace != null) { | 574 if (trace != null) { |
| 575 print(trace); | 575 print(trace); |
| 576 } | 576 } |
| 577 } finally { | 577 } finally { |
| 578 exit(253); // 253 is recognized as a crash by our test scripts. | 578 exit(253); // 253 is recognized as a crash by our test scripts. |
| 579 } | 579 } |
| 580 }); | 580 }); |
| 581 } | 581 } |
| 582 | 582 |
| 583 void main() { | 583 void main() { |
| 584 mainWithErrorHandler(new Options()); | 584 mainWithErrorHandler(new Options()); |
| 585 } | 585 } |
| OLD | NEW |