Instead of passing objects of type T, you can transfer things of type Option [T], wrapping all valid things of type T, for example
val thing = 1 val thingOption = Some(thing)
and saving all invalid data like Nones for example
val thingOption = None
Then, if you want to make a decision based on the value of thingOption, you can do it like this:
thingOption match { case None =>
source share