mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
more robust type cast in I/O functions
This commit is contained in:
parent
64936d551c
commit
0bd347d010
@ -110,6 +110,12 @@ const IoT& File::getData(const std::string &name) const
|
||||
LATAN_ERROR(Definition, "no data with name '" + name + "' in file "
|
||||
+ name_);
|
||||
}
|
||||
catch(std::bad_cast)
|
||||
{
|
||||
LATAN_ERROR(Definition, "data with name '" + name + "' in file "
|
||||
+ name_ + " does not have type '" + typeid(IoT).name()
|
||||
+ "'");
|
||||
}
|
||||
}
|
||||
|
||||
END_LATAN_NAMESPACE
|
||||
|
@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
process<DSample>(outFileName, fileName, code);
|
||||
}
|
||||
catch (bad_cast &e)
|
||||
catch (Exceptions::Definition)
|
||||
{
|
||||
process<DMatSample>(outFileName, fileName, code);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ int main(int argc, char *argv[])
|
||||
Io::save(s, copy, File::Mode::write, name);
|
||||
}
|
||||
}
|
||||
catch (bad_cast &e)
|
||||
catch (Exceptions::Definition)
|
||||
{
|
||||
DSample s = Io::load<DSample>(fileName);
|
||||
string name = Io::getFirstName(fileName);
|
||||
|
Loading…
Reference in New Issue
Block a user