😭
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
// 这是一个异常,当用户给的节点id超出最大值时抛出
|
||||
|
||||
#ifndef NODEIDOUTOFRANGEEXCEPTION_H
|
||||
#define NODEIDOUTOFRANGEEXCEPTION_H
|
||||
#include <exception>
|
||||
#include<string>
|
||||
|
||||
class NodeIdOutOfRangeException : public std::exception{
|
||||
private:
|
||||
std::string message;
|
||||
public:
|
||||
NodeIdOutOfRangeException():message("You input id is out of range"){}
|
||||
NodeIdOutOfRangeException(const std::string& msg) : message(msg) {}
|
||||
NodeIdOutOfRangeException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
|
||||
|
||||
virtual ~NodeIdOutOfRangeException() noexcept {}
|
||||
virtual const char* what() const noexcept override {
|
||||
return message.c_str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //NODEIDOUTOFRANGEEXCEPTION_H
|
||||
// 这是一个异常,当用户给的节点id超出最大值时抛出
|
||||
|
||||
#ifndef NODEIDOUTOFRANGEEXCEPTION_H
|
||||
#define NODEIDOUTOFRANGEEXCEPTION_H
|
||||
#include <exception>
|
||||
#include<string>
|
||||
|
||||
class NodeIdOutOfRangeException : public std::exception{
|
||||
private:
|
||||
std::string message;
|
||||
public:
|
||||
NodeIdOutOfRangeException():message("You input id is out of range"){}
|
||||
NodeIdOutOfRangeException(const std::string& msg) : message(msg) {}
|
||||
NodeIdOutOfRangeException(const std::string& msg,int errCode):message(msg+" Err code: "+std::to_string(errCode)){}
|
||||
|
||||
virtual ~NodeIdOutOfRangeException() noexcept {}
|
||||
virtual const char* what() const noexcept override {
|
||||
return message.c_str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif //NODEIDOUTOFRANGEEXCEPTION_H
|
||||
|
||||
Reference in New Issue
Block a user