writeErrorResponse method

Future<void> writeErrorResponse(
  1. dynamic request,
  2. dynamic err,
  3. dynamic stacktrace
)

Implementation

Future<void> writeErrorResponse(request, err, stacktrace) async {
  if (container.read('@environment') == Environment.production) {
    // if things are production, we need to treat this all differently.
    return await writeResponse(request, Future.value(Response.Boom()));
  } else {
    return await writeResponse(request, Future.value(Response.Boom('''
Something went wrong.
${err.toString()}

${stacktrace.toString()}
''')));
  }
}