X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fvehicletype.cpp;h=720b922a183a911bef72f9b916243a0bc1d9a63e;hb=621c5c938d70ba0d155e0eda91a708db0a52c0dc;hp=9f8814652770448aa1ae1dc84f5b4d542f4e167a;hpb=9bab44d27a89602565270e71d8684fb3f2fac5be;p=r2c2.git diff --git a/source/libr2c2/vehicletype.cpp b/source/libr2c2/vehicletype.cpp index 9f88146..720b922 100644 --- a/source/libr2c2/vehicletype.cpp +++ b/source/libr2c2/vehicletype.cpp @@ -1,4 +1,5 @@ #include +#include #include "vehicletype.h" using namespace std; @@ -25,30 +26,30 @@ unsigned VehicleType::get_max_function() const 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]; } @@ -274,7 +275,7 @@ void operator>>(const LexicalConverter &c, VehicleType::Rod::Limit &l) 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