api json 404
This commit is contained in:
parent
e03a12a588
commit
01b3dd99d0
|
@ -147,9 +147,12 @@ private[controllers] trait LilaController
|
|||
protected def OptionFuResult[A](fua: Fu[Option[A]])(op: A => Fu[Result])(implicit ctx: Context) =
|
||||
fua flatMap { _.fold(notFound(ctx))(a => op(a)) }
|
||||
|
||||
def notFound(implicit ctx: Context): Fu[Result] =
|
||||
def notFound(implicit ctx: Context): Fu[Result] = negotiate(
|
||||
html =
|
||||
if (HTTPRequest isSynchronousHttp ctx.req) Lobby renderHome Results.NotFound
|
||||
else Results.NotFound("resource not found").fuccess
|
||||
else fuccess(Results.NotFound("Resource not found")),
|
||||
api = _ => fuccess(Results.NotFound(Json.obj("error" -> "Resource not found")))
|
||||
)
|
||||
|
||||
protected def notFoundReq(req: RequestHeader): Fu[Result] =
|
||||
reqToCtx(req) flatMap (x => notFound(x))
|
||||
|
|
Loading…
Reference in a new issue