redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

Stacktraces are logged on severe for 400 range response codes #190

Closed stijnvanbael closed 8 years ago

stijnvanbael commented 8 years ago

When I do this:

throw new app.ErrorResponse(401, 'Missing header "Authorization"');

Then I see something like this in the logs:

package:next_adventure_server/src/security.dart 94:9   authorizationPlugin.<fn>.<async>
dart:async                                             _Completer.completeError
package:next_adventure_server/src/security.dart 119:4  authorizationPlugin.<fn>.<async>
dart:async                                             Future.Future.microtask
package:next_adventure_server/src/security.dart        authorizationPlugin.<fn>
package:redstone/src/route_processor.dart 99:13        RouteProcessor._createInvoker.<fn>.<fn>
package:redstone/src/route_processor.dart 66:32        RouteProcessor.call.<async>
dart:async                                             _SyncCompleter.complete
package:redstone/src/request_parser.dart 45:5          RequestParser.parseBody.<async>
dart:async                                             _asyncThenWrapperHelper
package:redstone/src/route_processor.dart              RouteProcessor.call
package:redstone/src/router.dart 427:31                _ChainImpl.next.<async>
dart:async                                             Future.Future.microtask
package:redstone/src/router.dart                       _ChainImpl.next
package:redstone_mapper/plugin.dart 93:32              getMapperPlugin.<fn>.<fn>.<async>
dart:async                                             _asyncThenWrapperHelper
package:redstone_mapper/plugin.dart                    getMapperPlugin.<fn>.<fn>
package:redstone/src/processor.dart 382:31             Processor._wrapDynamicInterceptor.<fn>.<async>
dart:async                                             Future.Future.microtask
package:redstone/src/processor.dart                    Processor._wrapDynamicInterceptor.<fn>
package:redstone/src/router.dart 397:44                _ChainImpl.next.<async>
dart:async                                             Future.Future.microtask
package:redstone/src/router.dart                       _ChainImpl.next
package:redstone/src/router.dart 473:12                _ChainImpl._start
package:redstone/src/router.dart 141:49                Router._handler.<async>
dart:async                                             Future.Future.microtask
package:redstone/src/router.dart                       Router._handler
package:shelf/src/cascade.dart 72:52                   Cascade.handler.<fn>
package:shelf/src/cascade.dart 73:44                   Cascade.handler.<fn>.<fn>
dart:async                                             Future.Future.sync
package:shelf/src/cascade.dart 73:18                   Cascade.handler.<fn>
package:redstone/src/router.dart 89:51                 Router._middleware.<fn>.<fn>.<async>
dart:async                                             Future.Future.microtask
package:redstone/src/router.dart                       Router._middleware.<fn>.<fn>
package:stack_trace                                    Chain.capture
package:redstone/src/router.dart 87:16                 Router._middleware.<fn>
package:shelf/shelf_io.dart 76:29                      handleRequest.<async>

This is a user error. I would expect a warning with a clear message of what is wrong, not a stacktrace.