-
-
Notifications
You must be signed in to change notification settings - Fork 11
This site collects some typical problems and pitfalls users of SCROLL might encounter.
SCROLL uses a custom equal and hashCode implementation for role-playing objects. If you are using Scala case classes make sure you understood their identity / comparison mechanism (see the official documentation).
For a regular Compartment, dynamic role method calls return Either[SCROLLError, E] where E is the return type of
your role method.
For MultiCompartment, calls return Either[SCROLLError, Seq[Either[SCROLLError, E]]]. The public
scroll.MultiDispatchResult alias and sequenceResults helper can be used to flatten successful results.
If you assign a role call directly to an expected value type, SCROLL also offers implicit unwrapping. In that case,
typed SCROLLErrors are rethrown on failure instead of being returned as Left(...).
You may want to check the return value explicitly:
import scroll.Compartment
val core = new Core()
new Compartment {
val someRole = new Role()
core play someRole
val result = +core someRoleMethod()
result match {
case Left(error) => handle(error)
case Right(returnValue) => // do something with it
}
}