ignore search failures

some queries are just too heavy
pull/6938/head
Thibault Duplessis 2020-07-04 10:07:16 +02:00
parent 66f2726a25
commit 175bf28b1f
1 changed files with 6 additions and 2 deletions

View File

@ -46,9 +46,11 @@ final class Search(env: Env) extends LilaController(env) {
failure => Ok(html.search.index(failure, none, nbGames)).fuccess,
data =>
data.nonEmptyQuery ?? { query =>
env.gameSearch.paginator(query, page) map (_.some)
env.gameSearch.paginator(query, page) map some
} map { pager =>
Ok(html.search.index(searchForm fill data, pager, nbGames))
} recover { _ =>
InternalServerError("Sorry, we can't process that query at the moment")
}
),
api = _ =>
@ -59,7 +61,7 @@ final class Search(env: Env) extends LilaController(env) {
}.fuccess,
data =>
data.nonEmptyQuery ?? { query =>
env.gameSearch.paginator(query, page).dmap(_.some)
env.gameSearch.paginator(query, page) dmap some
} flatMap {
case Some(s) =>
env.api.userGameApi.jsPaginator(s) dmap {
@ -67,6 +69,8 @@ final class Search(env: Env) extends LilaController(env) {
}
case None =>
BadRequest(jsonError("Could not process search query")).fuccess
} recover { _ =>
InternalServerError(jsonError("Sorry, we can't process that query at the moment"))
}
)
)