diff --git a/src/util/irep_serialization.cpp b/src/util/irep_serialization.cpp index 92f975ef949..5d47191efad 100644 --- a/src/util/irep_serialization.cpp +++ b/src/util/irep_serialization.cpp @@ -16,6 +16,7 @@ Date: May 2007 #include #include +#include "exception_utils.h" #include "string_hash.h" void irep_serializationt::write_irep( @@ -95,8 +96,7 @@ void irep_serializationt::read_irep( if(in.get()!=0) { - std::cerr << "irep not terminated\n"; - throw 0; + throw deserialization_exceptiont("irep not terminated"); } } @@ -150,7 +150,7 @@ std::size_t irep_serializationt::insert_on_read( std::pair(false, get_nil_irep())); if(ireps_container.ireps_on_read[id].first) - throw "irep id read twice."; + throw deserialization_exceptiont("irep id read twice."); else { ireps_container.ireps_on_read[id]= diff --git a/src/util/json_irep.cpp b/src/util/json_irep.cpp index a3fcac16592..375e06eb82a 100644 --- a/src/util/json_irep.cpp +++ b/src/util/json_irep.cpp @@ -11,6 +11,7 @@ Author: Thomas Kiley, thomas.kiley@diffblue.com #include "json_irep.h" +#include "exception_utils.h" #include "irep.h" #include "json.h" @@ -103,8 +104,11 @@ irept json_irept::convert_from_json(const jsont &in) const have_keys.push_back(keyval.first); std::sort(have_keys.begin(), have_keys.end()); if(have_keys!=std::vector{"comment", "id", "namedSub", "sub"}) - throw "irep JSON representation is missing one of needed keys: " - "'id', 'sub', 'namedSub', 'comment'"; + { + throw deserialization_exceptiont( + "irep JSON representation is missing one of needed keys: " + "'id', 'sub', 'namedSub', 'comment'"); + } irept out(in["id"].value);