Skip to content

Commit

Permalink
#1766 removed log error when wrong pattern type
Browse files Browse the repository at this point in the history
  • Loading branch information
rriclet committed Feb 18, 2021
1 parent a0567b5 commit a03ac68
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions thehive/app/org/thp/thehive/controllers/v1/PatternCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,12 @@ class PatternCtrl @Inject() (
inputPatterns
.sortBy(_.external_id.length) // sort to create sub-patterns after their parent
.foldLeft[JsArray](JsArray.empty) { (array, inputPattern) =>
val res = db.tryTransaction { implicit graph =>
createFromInput(inputPattern)
} match {
case Failure(e) =>
Json.obj("status" -> "Failure", "message" -> e.getMessage)
case Success(t) =>
Json.obj("status" -> "Success", "mitreId" -> t.patternId, "patternName" -> t.name)
}
array :+ res
array :+ db.tryTransaction { implicit graph =>
createFromInput(inputPattern).transform(
t => Success(Json.obj("status" -> "Success", "mitreId" -> t.patternId, "patternName" -> t.name)),
e => Success(Json.obj("status" -> "Failure", "message" -> e.getMessage))
)
}.get
}
} yield Results.Created(importedPatterns)
}
Expand Down

0 comments on commit a03ac68

Please sign in to comment.