Skip to content

Commit

Permalink
Add throws for unknown value_type and error_type
Browse files Browse the repository at this point in the history
  • Loading branch information
tokox committed Mar 30, 2024
1 parent 2c87fb0 commit cbb4e6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ IT& to(const object& obj, IT& it, int tab)
return vector_to(obj, it, tab);
case Map:
return map_to(obj, it, tab);
default:
throw std::runtime_error("Unknown value_type");
}
return it;
}
Expand Down
3 changes: 2 additions & 1 deletion import.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef TOKOX_CPP_JSON_IMPORT_HPP
#define TOKOX_CPP_JSON_IMPORT_HPP

#include <stdexcept>
#include "object.hpp"

namespace tokox::json
Expand Down Expand Up @@ -35,7 +36,7 @@ class import_error : public std::exception
case VALUE_NOT_IMPLEMENTED:
return "Value not implemented!";
default:
return "Unknown error!";
throw std::runtime_error("Unknown error_type!");
}
}
private:
Expand Down

0 comments on commit cbb4e6d

Please sign in to comment.