1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-04-10 19:20:44 +01:00

catch exceptions by ref

This commit is contained in:
Antonin Portelli 2024-02-10 19:38:02 +01:00
parent e8b0565164
commit 442624912e
3 changed files with 9 additions and 9 deletions

View File

@ -36,7 +36,7 @@ unsigned int RunContext::addFunction(const string &name, DoubleFunction *init)
return getFunctionAddress(name); return getFunctionAddress(name);
} }
catch (Exceptions::Definition) catch (Exceptions::Definition &)
{ {
unsigned int address = fTable_.size(); unsigned int address = fTable_.size();
@ -55,7 +55,7 @@ unsigned int RunContext::addVariable(const string &name, double init)
return getVariableAddress(name); return getVariableAddress(name);
} }
catch (Exceptions::Definition) catch (Exceptions::Definition &)
{ {
unsigned int address = vTable_.size(); unsigned int address = vTable_.size();
@ -92,7 +92,7 @@ unsigned int RunContext::getFunctionAddress(const string &name) const
{ {
return fTable_.at(name); return fTable_.at(name);
} }
catch (out_of_range) catch (out_of_range &)
{ {
LATAN_ERROR(Definition, "undefined function '" + name + "'"); LATAN_ERROR(Definition, "undefined function '" + name + "'");
} }
@ -139,7 +139,7 @@ unsigned int RunContext::getVariableAddress(const string &name) const
{ {
return vTable_.at(name); return vTable_.at(name);
} }
catch (out_of_range) catch (out_of_range &)
{ {
LATAN_ERROR(Definition, "undefined variable '" + name + "'"); LATAN_ERROR(Definition, "undefined variable '" + name + "'");
} }
@ -449,7 +449,7 @@ try\
{\ {\
address = (table).at(name);\ address = (table).at(name);\
}\ }\
catch (out_of_range)\ catch (out_of_range &)\
{\ {\
address = (table).size();\ address = (table).size();\
(table)[(name)] = address;\ (table)[(name)] = address;\

View File

@ -105,12 +105,12 @@ const IoT& File::getData(const std::string &name) const
{ {
return dynamic_cast<const IoT &>(*(data_.at(name))); return dynamic_cast<const IoT &>(*(data_.at(name)));
} }
catch(std::out_of_range) catch (std::out_of_range &)
{ {
LATAN_ERROR(Definition, "no data with name '" + name + "' in file " LATAN_ERROR(Definition, "no data with name '" + name + "' in file "
+ name_); + name_);
} }
catch(std::bad_cast) catch (std::bad_cast &)
{ {
LATAN_ERROR(Definition, "data with name '" + name + "' in file " LATAN_ERROR(Definition, "data with name '" + name + "' in file "
+ name_ + " does not have type '" + typeid(IoT).name() + name_ + " does not have type '" + typeid(IoT).name()

View File

@ -75,7 +75,7 @@ void loadAndCheck(vector<DMatSample> &sample, const vector<string> &fileName)
gotSize = true; gotSize = true;
} }
} }
catch (Exceptions::Definition) catch (Exceptions::Definition &)
{ {
failed.insert(i); failed.insert(i);
} }
@ -233,7 +233,7 @@ int main(int argc, char *argv[])
{ {
process<DSample>(outFileName, fileName, code); process<DSample>(outFileName, fileName, code);
} }
catch (Exceptions::Definition) catch (Exceptions::Definition &)
{ {
process<DMatSample>(outFileName, fileName, code); process<DMatSample>(outFileName, fileName, code);
} }