exception.h (400B)
1 #pragma once 2 3 #include <stdexcept> 4 #include <string> 5 6 namespace networkLib 7 { 8 enum ExceptionType 9 { 10 ConnectionClosed, 11 ConnectionLost 12 }; 13 14 class NetException : public std::runtime_error 15 { 16 public: 17 NetException(const ExceptionType _type, const std::string& _err) : std::runtime_error(_err), m_type(_type) 18 { 19 } 20 21 auto type() const { return m_type; } 22 23 private: 24 ExceptionType m_type; 25 }; 26 }