Check whether exceptions are enabled on the output iostream and throw or not throw errors accordingly.