Add stream exception handling