Skip to content

Commit

Permalink
quick fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianKirmaier committed Jan 15, 2025
1 parent 82d238a commit f9cdb0c
Showing 1 changed file with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,4 @@ object Filters {
route.and(function)
}

def errorPage(): Filter = errorPage((request, ex) => Response.node(new Label("Error: " + ex.getMessage)))
def errorPage(biFunction: BiFunction[Request, Throwable, Response]): Filter = {
route => { request =>
try {
val r = route.apply(request)
Response.fromFuture(r.future.map(x => Response.fromResult(x)).exceptionally { ex =>
biFunction.apply(request, ex)
})
} catch {
case ex: Throwable =>
biFunction.apply(request, ex)
}
}
}

def notFoundPage(): Filter = {
notFoundPage((request) => Response.node(new Label("Not Found: " + request.getPath())))
}
def notFoundPage(function: Route): Filter = { route =>
route.and(function)
}

}

0 comments on commit f9cdb0c

Please sign in to comment.