fix more runtime exceptions D:
This commit is contained in:
parent
9435a42567
commit
d923130dbb
|
@ -118,7 +118,9 @@ object JsTube {
|
|||
) andThen (__ \ from).json.prune
|
||||
|
||||
def readDate(field: Symbol) =
|
||||
(__ \ field).json.update(of[JsObject] map { o => (o \ "$date").get })
|
||||
(__ \ field).json.update(of[JsObject] map { o =>
|
||||
(o \ "$date").toOption err s"Can't read date of $o"
|
||||
})
|
||||
|
||||
def readDateOpt(field: Symbol) = readDate(field) orElse json.reader
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ import play.modules.reactivemongo.json._
|
|||
sort = JsObjectWriter.write(Json.obj("updatedAt" -> -1)).some)
|
||||
|
||||
tube.threadTube.coll.runCommand(command) map { res =>
|
||||
BSONFormats.toJSON(res).arr("results").flatMap(_.apply(0).get str "value")
|
||||
BSONFormats.toJSON(res).arr("results").flatMap(_.apply(0).toOption).flatMap(_ str "value")
|
||||
} map {
|
||||
_ ?? (_ split ';' toList)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue