Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 6144309

Browse files
committed
新增: 网络错误异常和MAH异常.
1 parent ea97044 commit 6144309

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#pragma once
2+
#ifndef mirai_cpp_exceptions_exceptions_hpp_H_
3+
#define mirai_cpp_exceptions_exceptions_hpp_H_
4+
5+
#include "mirai_api_http_exception.hpp"
6+
#include "network_exception.hpp"
7+
8+
#endif // !mirai_cpp_exceptions_exceptions_hpp_H_
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
#ifndef mirai_cpp_exceptions_mirai_api_http_exception_hpp_H_
3+
#define mirai_cpp_exceptions_mirai_api_http_exception_hpp_H_
4+
5+
#include <exception>
6+
#include <string>
7+
8+
namespace Cyan
9+
{
10+
/**
11+
* @brief mirai-api-http Òì³£
12+
*/
13+
class MiraiApiHttpException : public std::runtime_error
14+
{
15+
public:
16+
const int Code;
17+
const string Message;
18+
MiraiApiHttpException(int code, const std::string& error_msg) :
19+
Code(code),
20+
Message(error_msg),
21+
std::runtime_error("mirai-api-http ´íÎó: " + error_msg) {}
22+
virtual ~MiraiApiHttpException() = default;
23+
};
24+
25+
}
26+
27+
#endif // !mirai_cpp_exceptions_mirai_api_http_exception_hpp_H_
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#pragma once
2+
#ifndef mirai_cpp_exceptions_network_exception_hpp_H_
3+
#define mirai_cpp_exceptions_network_exception_hpp_H_
4+
5+
#include <exception>
6+
7+
namespace Cyan
8+
{
9+
/**
10+
* @brief ÍøÂç´íÎóÒì³£
11+
*/
12+
class NetworkException : public std::runtime_error
13+
{
14+
public:
15+
NetworkException(): std::runtime_error("ÍøÂç´íÎó.") {}
16+
virtual ~NetworkException() = default;
17+
};
18+
19+
}
20+
21+
#endif // !mirai_cpp_exceptions_network_exception_hpp_H_

0 commit comments

Comments
 (0)