stream: make error check a bit more readable.