Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SI-7474 Record extra errors in Throwable#suppressedExceptions
... in parallel collection operations. Followup to bcbe38d, which did away with the the approach to use a composite exception when more than one error happened.
- Loading branch information
Showing
3 changed files
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
Runtime exception | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,16 @@ | ||
object Test extends App { | ||
val foos = (1 to 1000).toSeq | ||
try | ||
foos.par.map(i => if (i % 37 == 0) sys.error("i div 37") else i) | ||
catch { | ||
case ex: RuntimeException => println("Runtime exception") | ||
try { | ||
foos.par.map(i => if (i % 37 == 0) throw new MultipleOf37Exception(i) else i) | ||
assert(false) | ||
} catch { | ||
case ex: MultipleOf37Exception => | ||
assert(ex.getSuppressed.size > 0) | ||
assert(ex.getSuppressed.forall(_.isInstanceOf[MultipleOf37Exception])) | ||
assert(ex.i == 37) | ||
assert(ex.getSuppressed.map(_.asInstanceOf[MultipleOf37Exception].i).toList == List(74, 148, 259, 518)) | ||
case _: Throwable => | ||
assert(false) | ||
} | ||
class MultipleOf37Exception(val i: Int) extends RuntimeException | ||
} |