Angular: v3.0 alpha consumes runtime errors

Created on 13 Feb 2017  路  6Comments  路  Source: angulardart/angular

Runtime errors don't appear to show up at all (console, print debug, you name it) with the new alpha version while a proper stacktrace is presented in 2.2.0. Is this expected or a known issue?

Most helpful comment

Yup, known issue. Thanks for filing. Will try to get this fixed for next alpha push.

In the mean-time you can "fix" it by overriding the ExceptionHandler class:

bootstrap(..., [
  provide(ExceptionHandler, useClass: BrowserExceptionHandler),
]);

@Injectable()
class BrowserExceptionHandler implements ExceptionHandler {
  const BrowserExceptionHandler();

  @override
  void call(exception, [stackTrace, String reason]) {
    window.console.error(ExceptionHandler.exceptionToString(
      exception,
      stackTrace,
      reason,
    ));
  }
}

I'll try to get this shipped as the default in the next version.

All 6 comments

Yup, known issue. Thanks for filing. Will try to get this fixed for next alpha push.

In the mean-time you can "fix" it by overriding the ExceptionHandler class:

bootstrap(..., [
  provide(ExceptionHandler, useClass: BrowserExceptionHandler),
]);

@Injectable()
class BrowserExceptionHandler implements ExceptionHandler {
  const BrowserExceptionHandler();

  @override
  void call(exception, [stackTrace, String reason]) {
    window.console.error(ExceptionHandler.exceptionToString(
      exception,
      stackTrace,
      reason,
    ));
  }
}

I'll try to get this shipped as the default in the next version.

Thanks for your prompt response, your fix works and seems adequate for now. This is on me: :beers: :)

Thanks, I was also looking for this.

~~In aplha+1, RTE's are still consumed, even if I provide an ExceptionHandler (as shown in the above example).

I can see errors passing through ng_zone https://github.com/dart-lang/angular2/blob/master/lib/src/core/zone/ng_zone.dart#L218, but seeing no log~~

Fixed by moving provide(ExceptionHandler, useClass: BrowserExceptionHandler) into the bootstrap, intially, I had it provided one child level below the main file

Just to make it clear, still chugging on this one a bit - there were a lot of internal tests that needed to be updated. Still will make it in by 3.0 beta.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndreyChernykh picture AndreyChernykh  路  4Comments

iu4u57k3 picture iu4u57k3  路  6Comments

Adamovskiy picture Adamovskiy  路  6Comments

cedx picture cedx  路  6Comments

double11one picture double11one  路  6Comments