From 4017bc168232fb28a4cf558af21f3b2082944da6 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Tue, 21 Aug 2018 10:28:53 -0400 Subject: [PATCH] dart:mirrors is completely gone from Angel --- lib/src/core/request_context.dart | 1 - lib/src/http/angel_http.dart | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/src/core/request_context.dart b/lib/src/core/request_context.dart index deeec10e..7c47b86e 100644 --- a/lib/src/core/request_context.dart +++ b/lib/src/core/request_context.dart @@ -2,7 +2,6 @@ library angel_framework.http.request_context; import 'dart:async'; import 'dart:io' show Cookie, HttpHeaders, HttpSession, InternetAddress; -//import 'dart:mirrors'; import 'package:angel_container/angel_container.dart'; import 'package:body_parser/body_parser.dart'; diff --git a/lib/src/http/angel_http.dart b/lib/src/http/angel_http.dart index d2b1c950..0dfedcbc 100644 --- a/lib/src/http/angel_http.dart +++ b/lib/src/http/angel_http.dart @@ -173,10 +173,21 @@ class AngelHttp { if (e is FormatException) throw new AngelHttpException.badRequest(message: e.message) ..stackTrace = st; - throw new AngelHttpException(e, stackTrace: st, statusCode: 500); + throw new AngelHttpException(e, + stackTrace: st, + statusCode: 500, + message: e?.toString() ?? '500 Internal Server Error'); }, test: (e) => e is! AngelHttpException).catchError( (ee, StackTrace st) { var e = ee as AngelHttpException; + + if (app.logger != null) { + var error = e.error ?? e; + var trace = + new Trace.from(e.stackTrace ?? StackTrace.current).terse; + app.logger.severe(e.message ?? e.toString(), error, trace); + } + return handleAngelHttpException( e, e.stackTrace ?? st, req, res, request); }); @@ -201,7 +212,9 @@ class AngelHttp { e = error; } else { e = new AngelHttpException(error, - stackTrace: stackTrace, message: error?.toString()); + stackTrace: stackTrace, + message: + error?.toString() ?? '500 Internal Server Error'); } if (app.logger != null) {