diff --git a/src/Assembleur.cpp b/src/Assembleur.cpp index b2637a0..6583b9e 100644 --- a/src/Assembleur.cpp +++ b/src/Assembleur.cpp @@ -53,7 +53,7 @@ std::uint32_t Assembleur::ParseLabel(const std::string& a_Label) { auto it = m_Labels.find(a_Label); if (it == m_Labels.end()) { - throw std::runtime_error("Label " + a_Label + " not found !"); + throw std::invalid_argument("Label " + a_Label + " not found !"); } return it->second; @@ -105,10 +105,10 @@ std::uint32_t Assembleur::ParseIO(Instruction a_Instruction, std::uint32_t a_R1, static std::uint32_t ParseRegistry(const std::string& a_Str) { if (a_Str.at(0) != 'R') - throw std::runtime_error("Registry " + a_Str + " not found !"); + throw std::invalid_argument("Registry " + a_Str + " not found !"); std::uint32_t registry = std::stoi(a_Str.substr(1)); if (registry > 7) - throw std::runtime_error("You can only have up to 8 registries !"); + throw std::invalid_argument("You can only have up to 8 registries !"); return registry; } @@ -118,7 +118,7 @@ static bool IsConstant(const std::string& a_Str) { static std::uint32_t ParseConstant(const std::string& a_Str) { if (a_Str.at(0) != '#') - throw std::runtime_error("Registry " + a_Str + " not found !"); + throw std::invalid_argument("Registry " + a_Str + " not found !"); return std::stoi(a_Str.substr(1)); } @@ -129,7 +129,7 @@ std::uint32_t Assembleur::ParseInstruction(const std::string& a_Str, std::uint32 auto it = INSTRUCTION_KEYS.find(ins); if (it == INSTRUCTION_KEYS.end()) { - throw std::runtime_error("[Line " + std::to_string(a_RealLine) + "] " + "Instruction \"" + ins + "\" not found !"); + throw std::invalid_argument("[Line " + std::to_string(a_RealLine) + "] " + "Instruction \"" + ins + "\" not found !"); } Instruction instruction = it->second; @@ -177,8 +177,8 @@ std::uint32_t Assembleur::ParseInstruction(const std::string& a_Str, std::uint32 } } - } catch (std::runtime_error& e) { - throw std::runtime_error("[Line " + std::to_string(a_RealLine) + "] " + e.what()); + } catch (std::invalid_argument& e) { + throw std::invalid_argument("[Line " + std::to_string(a_RealLine) + "] " + e.what()); } return 0;