serverError method

Response serverError([
  1. String? error,
  2. List<String>? logs
])

A shelf.Response for API calls that encountered a server error e.g., setActiveSurvey not called.

This is a 500 Internal Server Error response.

Implementation

shelf.Response serverError([String? error, List<String>? logs]) {
  if (error != null) print(error);
  return shelf.Response(
    HttpStatus.internalServerError,
    body: error != null || logs != null
        ? jsonEncode(<String, Object?>{
            if (error != null) errorKey: error,
            if (logs != null) logsKey: logs,
          })
        : null,
  );
}