Skip to content

Commit

Permalink
Make rootCause cross-platform without shims
Browse files Browse the repository at this point in the history
  • Loading branch information
valencik committed Jun 25, 2022
1 parent 64fee65 commit 106fe8b
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.

This file was deleted.

4 changes: 0 additions & 4 deletions munit/js/src/main/scala/munit/internal/PlatformCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,4 @@ object PlatformCompat {
private var myClassLoader: ClassLoader = _
def setThisClassLoader(loader: ClassLoader): Unit = myClassLoader = loader
def getThisClassLoader: ClassLoader = myClassLoader

type InvocationTargetException = munit.internal.InvocationTargetException
type UndeclaredThrowableException =
munit.internal.UndeclaredThrowableException
}

This file was deleted.

5 changes: 1 addition & 4 deletions munit/shared/src/main/scala/munit/MUnitRunner.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package munit

import munit.internal.FutureCompat._
import munit.internal.PlatformCompat.InvocationTargetException
import munit.internal.PlatformCompat
import munit.internal.PlatformCompat.UndeclaredThrowableException
import munit.internal.console.Printers
import munit.internal.console.StackTraces
import munit.internal.junitinterface.Configurable
Expand Down Expand Up @@ -318,8 +316,7 @@ class MUnitRunner(val cls: Class[_ <: Suite], newInstance: () => Suite)
// NOTE(olafur): these exceptions appear when we await on futures. We unwrap
// these exception in order to provide more helpful error messages.
private def rootCause(x: Throwable): Throwable = x match {
case _: InvocationTargetException | _: ExceptionInInitializerError |
_: UndeclaredThrowableException | _: ExecutionException
case _: ExceptionInInitializerError | _: ExecutionException
if x.getCause != null =>
rootCause(x.getCause)
case _ => x
Expand Down

0 comments on commit 106fe8b

Please sign in to comment.