Skip to content

Commit

Permalink
#29 Catch error of MISP_modules loader invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed May 22, 2017
1 parent 2de4fe8 commit ef22537
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/services/MispSrv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class MispSrv(

private[MispSrv] val futureList: Future[Seq[MispModule]] = Future {
if (mispModulesEnabled) {
Json.parse(s"$loaderCommand --list".!!)
.asOpt[Seq[String]]
.getOrElse {
logger.warn("MISP modules loader returns invalid data")
val moduleNameList = Try(Json.parse(s"$loaderCommand --list".!!).as[Seq[String]]) match {
case Success(l) l
case Failure(error)
logger.error(s"MISP module loader fails", error)
Nil
}
}

moduleNameList
.map { moduleName
moduleName (for {
moduleInfo Try(Json.parse(s"$loaderCommand --info $moduleName".!!))
Expand Down

0 comments on commit ef22537

Please sign in to comment.