Catch std::ios_base::failure exceptions, which mean EOF when reading JSON from a std::stringstream