Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Jan 2, 2025
1 parent 701b38d commit f856f3a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions integration/failure/fatal-error/resources/build.mill
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package build
import mill._

def fatalTask = Task{
def fatalException(msg: String) = {
// Needs to be a fatal error according to scala.util.control.NonFatal,
// not just any error!
val ex = new java.lang.LinkageError("CUSTOM FATAL ERROR IN TASK")
val ex = new java.lang.LinkageError(msg)
assert(scala.util.control.NonFatal.apply(ex))
throw ex
ex
}
def fatalTask = Task{
throw fatalException("CUSTOM FATAL ERROR IN TASK")
123
}

def upstream = Task.Input(math.random())
def alwaysInvalidates = Task.Input(math.random())
def fatalCloseWorker = Task.Worker{
upstream()
alwaysInvalidates()
new AutoCloseable {
override def close(): Unit =
throw new java.lang.LinkageError("CUSTOM FATAL ERROR ON CLOSE")
throw fatalException("CUSTOM FATAL ERROR ON CLOSE")
}
}

0 comments on commit f856f3a

Please sign in to comment.