#include <msp/core/maputils.h>
+#include <msp/strings/format.h>
#include "vehicletype.h"
using namespace std;
const VehicleType::Axle &VehicleType::get_fixed_axle(unsigned i) const
{
if(i>=axles.size())
- throw InvalidParameterValue("Axle index out of range");
+ throw out_of_range("VehicleType::get_fixed_axle");
return axles[i];
}
const VehicleType::Bogie &VehicleType::get_bogie(unsigned i) const
{
if(i>=bogies.size())
- throw InvalidParameterValue("Axle index out of range");
+ throw out_of_range("VehicleType::get_bogie");
return bogies[i];
}
const VehicleType::Axle &VehicleType::get_bogie_axle(unsigned i, unsigned j) const
{
if(i>=bogies.size())
- throw InvalidParameterValue("Axle index out of range");
+ throw out_of_range("VehicleType::get_bogie_axle");
if(j>=bogies[i].axles.size())
- throw InvalidParameterValue("Axle index out of range");
+ throw out_of_range("VehicleType::get_bogie_axle");
return bogies[i].axles[j];
}
const VehicleType::Rod &VehicleType::get_rod(unsigned i) const
{
if(i>=rods.size())
- throw InvalidParameterValue("Rod index out of range");
+ throw out_of_range("VehicleType::get_rod");
return rods[i];
}
else if(s=="SLIDE_X")
l = VehicleType::Rod::SLIDE_X;
else
- throw LexicalError("Invalid value for Rod::Limit");
+ throw lexical_error(format("conversion of '%s' to Rod::Limit", s));
}
} // namespace R2C2