12bc23fe1SPatrick Venture #pragma once
22bc23fe1SPatrick Venture 
32bc23fe1SPatrick Venture #include <exception>
42bc23fe1SPatrick Venture #include <string>
52bc23fe1SPatrick Venture 
69b534f06SPatrick Venture namespace host_tool
79b534f06SPatrick Venture {
89b534f06SPatrick Venture 
92bc23fe1SPatrick Venture class ToolException : public std::exception
102bc23fe1SPatrick Venture {
112bc23fe1SPatrick Venture   public:
ToolException(const std::string & message)122bc23fe1SPatrick Venture     explicit ToolException(const std::string& message) : message(message){};
132bc23fe1SPatrick Venture 
what() const142bc23fe1SPatrick Venture     virtual const char* what() const noexcept override
152bc23fe1SPatrick Venture     {
162bc23fe1SPatrick Venture         return message.c_str();
172bc23fe1SPatrick Venture     }
182bc23fe1SPatrick Venture 
192bc23fe1SPatrick Venture   private:
202bc23fe1SPatrick Venture     std::string message;
212bc23fe1SPatrick Venture };
229b534f06SPatrick Venture 
23*e5aafa5bSBenjamin Fair class NotFoundException : public ToolException
24*e5aafa5bSBenjamin Fair {
25*e5aafa5bSBenjamin Fair   public:
NotFoundException(const std::string & device)26*e5aafa5bSBenjamin Fair     explicit NotFoundException(const std::string& device) :
27*e5aafa5bSBenjamin Fair         ToolException(std::string("Couldn't find " + device)){};
28*e5aafa5bSBenjamin Fair };
29*e5aafa5bSBenjamin Fair 
309b534f06SPatrick Venture } // namespace host_tool
31