Replace Base::Exception with appropriate subclass

This commit is contained in:
wmayer
2018-11-14 17:47:43 +01:00
parent d11bfed7c6
commit cda4c96fa8
7 changed files with 12 additions and 12 deletions

View File

@@ -155,7 +155,7 @@ void Command::setFromGCode (const std::string& str)
value = "";
mode = "argument";
} else {
throw Base::Exception("Badly formatted GCode command");
throw Base::BadFormatError("Badly formatted GCode command");
}
mode = "argument";
} else if (mode == "none") {
@@ -168,7 +168,7 @@ void Command::setFromGCode (const std::string& str)
key = "";
value = "";
} else {
throw Base::Exception("Badly formatted GCode argument");
throw Base::BadFormatError("Badly formatted GCode argument");
}
} else if (mode == "comment") {
value += str[i];
@@ -198,7 +198,7 @@ void Command::setFromGCode (const std::string& str)
Parameters[key] = val;
}
} else {
throw Base::Exception("Badly formatted GCode argument");
throw Base::BadFormatError("Badly formatted GCode argument");
}
}

View File

@@ -99,7 +99,7 @@ void Toolpath::insertCommand(const Command &Cmd, int pos)
Command *tmp = new Command(Cmd);
vpcCommands.insert(vpcCommands.begin()+pos,tmp);
} else {
throw Base::Exception("Index not in range");
throw Base::IndexError("Index not in range");
}
recalculate();
}
@@ -112,7 +112,7 @@ void Toolpath::deleteCommand(int pos)
} else if (pos <= static_cast<int>(vpcCommands.size())) {
vpcCommands.erase (vpcCommands.begin()+pos);
} else {
throw Base::Exception("Index not in range");
throw Base::IndexError("Index not in range");
}
recalculate();
}
@@ -282,7 +282,7 @@ void Toolpath::recalculate(void) // recalculates the path cache
}
}
} catch (KDL::Error &e) {
throw Base::Exception(e.Description());
throw Base::RuntimeError(e.Description());
}
#endif
}

View File

@@ -307,7 +307,7 @@ void Tooltable::deleteTool(int pos)
if (Tools.find(pos) != Tools.end()) {
Tools.erase(pos);
} else {
throw Base::Exception("Index not found");
throw Base::IndexError("Index not found");
}
}