Created
April 8, 2018 03:23
-
-
Save brianhsu/7e97bfb94df605f030c675330e1fb973 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
abstract class UseCaseExecutor { | |
def execute[T](useCase: UseCase[T]): Try[T] = { | |
Try { | |
useCase.validate().foreach { error => throw error } | |
val result = useCase.execute() | |
useCase.journal.foreach(appendJournal) | |
result | |
} | |
} | |
def appendJournal(journal: Journal): Unit | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment