Better errors kinda
This commit is contained in:
parent
aea4ec1cf2
commit
2cb63347a7
2 changed files with 9 additions and 1 deletions
|
@ -29,6 +29,7 @@ typedef Future AngelConfigurer(AngelBase app);
|
|||
class Angel extends AngelBase {
|
||||
var _afterProcessed = new StreamController<HttpRequest>.broadcast();
|
||||
var _beforeProcessed = new StreamController<HttpRequest>.broadcast();
|
||||
var _fatalErrorStream = new StreamController<Map>.broadcast();
|
||||
var _onController = new StreamController<Controller>.broadcast();
|
||||
ServerGenerator _serverGenerator =
|
||||
(address, port) async => await HttpServer.bind(address, port);
|
||||
|
@ -39,6 +40,9 @@ class Angel extends AngelBase {
|
|||
/// Fired before a request is processed. Always runs.
|
||||
Stream<HttpRequest> get beforeProcessed => _beforeProcessed.stream;
|
||||
|
||||
/// Fired on fatal errors.
|
||||
Stream<Map> get fatalErrorStream => _fatalErrorStream.stream;
|
||||
|
||||
/// Fired whenever a controller is added to this instance.
|
||||
///
|
||||
/// **NOTE**: This is a broadcast stream.
|
||||
|
@ -312,6 +316,10 @@ class Angel extends AngelBase {
|
|||
_onError(e, [StackTrace stackTrace]) {
|
||||
stderr.write(e.toString());
|
||||
if (stackTrace != null) stderr.write(stackTrace.toString());
|
||||
_fatalErrorStream.add({
|
||||
"error": e,
|
||||
"stack": stackTrace
|
||||
});
|
||||
}
|
||||
|
||||
Angel() : super() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: angel_framework
|
||||
version: 1.0.0-dev.18
|
||||
version: 1.0.0-dev.19
|
||||
description: Core libraries for the Angel framework.
|
||||
author: Tobe O <thosakwe@gmail.com>
|
||||
homepage: https://github.com/angel-dart/angel_framework
|
||||
|
|
Loading…
Reference in a new issue