Skip to content
This repository has been archived by the owner on Feb 7, 2019. It is now read-only.

Commit

Permalink
Fixes #9118: Control.bestEffort duplicate the last failure
Browse files Browse the repository at this point in the history
  • Loading branch information
fanf committed Sep 26, 2016
1 parent c47993f commit 7f290bb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions utils/src/main/scala/com/normation/utils/Control.scala
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ object Control {
var errors = Option.empty[Failure]
seq.foreach { u => f(u) match {
case e:EmptyBox =>
val msg = e match {
case f:Failure => f.messageChain
val fail = e match {
case f:Failure => f
// these case should never happen, because Empty is verbotten, so took a
// not to bad solution - u.toString can be very ugly, so limit size.
case Empty => s"An error occured while processing: ${u.toString().take(20)}"
case Empty => Failure(s"An error occured while processing: ${u.toString().take(20)}")
}
errors match {
case None => errors = Some(e ?~! msg)
case Some(f) => errors = Some(Failure(msg, Empty, Full(f)))
case None => errors = Some(fail)
case Some(f) => errors = Some(Failure(fail.msg, Empty, Full(f)))
}
case Full(x) => buf += x
} }
Expand Down

0 comments on commit 7f290bb

Please sign in to comment.