Source
Future<Response> handleRequest(Request request, Pipeline pipe) async {
Future<Response> run() async {
context.container = context.container
.bind(Request, to: request);
try {
return await pipe(request);
} on NoResponseFromPipelineException {
return new Response.notFound('Not Found');
} on HttpException catch(e) {
return _responseMaker.parse(e.body).status(e.statusCode);
} catch(e, s) {
TraceFormatter.print(e, s);
return new Response.internalServerError(body: 'Internal Server Error');
}
}
return runInContext/*<Future<Response>>*/(container, run);
}