Skip to content
Snippets Groups Projects
errors.hh 430 B
Newer Older
  • Learn to ignore specific revisions
  • Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    #ifndef __VEREIGN_SQLITE_ERROR_HH
    #define __VEREIGN_SQLITE_ERROR_HH
    
    #include <stdexcept>
    
    namespace vereign::sqlite {
    
    
    class Error : public std::runtime_error {
    
    Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
    public:
    
      Error(int code, const std::string& msg)
        : std::runtime_error(msg),
          code_{code}
      {
    
    Daniel Lyubomirov's avatar
    Daniel Lyubomirov committed
      }
    
      auto code() const noexcept -> int {
        return code_;
      }
    
    private:
      int code_;
    };
    
    } // namespace vereign::sqlite
    
    #endif // __VEREIGN_SQLITE_CONNECTION_HH