forked from com-lihaoyi/mill
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
6 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
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") | ||
} | ||
} |