updated error reporting code to match the behavior of the streams and parsers