Throw \Exceptions\ObjectError when SaveTostream.

If the resource is not a valid resource then throw
\Exceptions\ObjectError.