ErisPulse 2.1.14.dev1__tar.gz → 2.1.14.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/PKG-INFO +1 -1
  2. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AIDocs/ErisPulse-AdapterDev.md +100 -91
  3. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AIDocs/ErisPulse-Core.md +95 -85
  4. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AIDocs/ErisPulse-Full.md +100 -91
  5. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AIDocs/ErisPulse-ModuleDev.md +100 -91
  6. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/CHANGELOG.md +11 -0
  7. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/UseCore.md +20 -1
  8. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/Core/adapter.md +2 -2
  9. erispulse-2.1.14.dev2/docs/api/ErisPulse/Core/config.md +17 -0
  10. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/Core/env.md +2 -2
  11. erispulse-2.1.14.dev2/docs/api/ErisPulse/Core/erispulse_config.md +60 -0
  12. erispulse-2.1.14.dev2/docs/api/ErisPulse/Core/exceptions.md +45 -0
  13. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/Core/logger.md +2 -2
  14. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/Core/mods.md +2 -2
  15. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/Core/router.md +2 -2
  16. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/__init__.md +3 -4
  17. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/api/ErisPulse/__main__.md +2 -2
  18. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/pyproject.toml +1 -1
  19. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/__init__.py +2 -2
  20. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/adapter.py +9 -12
  21. erispulse-2.1.14.dev2/src/ErisPulse/Core/config.py +74 -0
  22. erispulse-2.1.14.dev2/src/ErisPulse/Core/erispulse_config.py +105 -0
  23. erispulse-2.1.14.dev2/src/ErisPulse/Core/exceptions.py +108 -0
  24. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/logger.py +1 -1
  25. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/__init__.py +15 -6
  26. erispulse-2.1.14.dev1/CHANGELOG_1.x.md +0 -378
  27. erispulse-2.1.14.dev1/docs/api/ErisPulse/Core/config.md +0 -61
  28. erispulse-2.1.14.dev1/docs/api/ErisPulse/Core/exceptions.md +0 -74
  29. erispulse-2.1.14.dev1/src/ErisPulse/Core/config.py +0 -172
  30. erispulse-2.1.14.dev1/src/ErisPulse/Core/exceptions.py +0 -136
  31. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/assets/docs/install_pip.gif +0 -0
  32. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/assets/erispulse_logo.png +0 -0
  33. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/tools/merge_md.py +0 -0
  34. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/tools/update-api-docs.py +0 -0
  35. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/workflows/auto-tag-release.yml +0 -0
  36. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.github/workflows/pypi-publish.yml +0 -0
  37. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.gitignore +0 -0
  38. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/.python-version +0 -0
  39. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/CODE_OF_CONDUCT.md +0 -0
  40. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/LICENSE +0 -0
  41. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/README.md +0 -0
  42. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/devs/test.py +0 -0
  43. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/devs/test_adapter.py +0 -0
  44. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/devs/test_files/test.docx +0 -0
  45. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/devs/test_files/test.jpg +0 -0
  46. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/devs/test_files/test.mp4 +0 -0
  47. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AIModuleGeneration.md +0 -0
  48. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AdapterStandards/APIResponse.md +0 -0
  49. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AdapterStandards/EventConversion.md +0 -0
  50. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/AdapterStandards/README.md +0 -0
  51. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/CLI.md +0 -0
  52. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/Development/Adapter.md +0 -0
  53. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/Development/CLI.md +0 -0
  54. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/Development/Module.md +0 -0
  55. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/Development/README.md +0 -0
  56. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/PlatformFeatures.md +0 -0
  57. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/docs/quick-start.md +0 -0
  58. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-adapter/LICENSE +0 -0
  59. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-adapter/MyAdapter/Core.py +0 -0
  60. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-adapter/MyAdapter/__init__.py +0 -0
  61. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-adapter/README.md +0 -0
  62. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-adapter/pyproject.toml +0 -0
  63. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-cli-module/LICENSE +0 -0
  64. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-cli-module/README.md +0 -0
  65. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-cli-module/my_cli_module/__init__.py +0 -0
  66. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-cli-module/my_cli_module/cli.py +0 -0
  67. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-cli-module/pyproject.toml +0 -0
  68. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-module/LICENSE +0 -0
  69. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-module/MyModule/Core.py +0 -0
  70. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-module/MyModule/__init__.py +0 -0
  71. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-module/README.md +0 -0
  72. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/examples/example-module/pyproject.toml +0 -0
  73. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/scripts/install/install.ps1 +0 -0
  74. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/scripts/install/install.sh +0 -0
  75. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/env.py +0 -0
  76. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/mods.py +0 -0
  77. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/Core/router.py +0 -0
  78. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/src/ErisPulse/__main__.py +0 -0
  79. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/style_guide/DOCSTRING_SPEC.md +0 -0
  80. {erispulse-2.1.14.dev1 → erispulse-2.1.14.dev2}/style_guide/README.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ErisPulse
3
- Version: 2.1.14.dev1
3
+ Version: 2.1.14.dev2
4
4
  Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
5
5
  Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>, runoneall <runoobsteve@gmail.com>
6
6
  License: MIT License
@@ -113,14 +113,34 @@ if module_config is None:
113
113
  config.setConfig("MyModule", {"MyKey": "MyValue"}) # 设置默认配置
114
114
  ```
115
115
 
116
+ ### 4. 异常处理模块(exceptions)
117
+ ```python
118
+ # ErisPulse提供了统一的异常处理机制,可以自动捕获和格式化异常信息
119
+ # 对于异步代码,可以为特定事件循环设置异常处理器
120
+
121
+ import asyncio
122
+ from ErisPulse.Core import exceptions
123
+
124
+ # 为当前运行的事件循环设置异常处理器
125
+ loop = asyncio.get_running_loop()
126
+ exceptions.setup_async_loop(loop)
127
+
128
+ # 或者不传参数,自动获取当前事件循环 || 但不建议这么做,因为运行主程序时可能使用了其他的异步库
129
+ exceptions.setup_async_loop()
130
+
131
+ # 这样设置后,异步代码中的未捕获异常会被统一处理并格式化输出
132
+ ```
133
+
116
134
  ### 建议
117
135
  1. 模块配置应使用`getConfig/setConfig`操作config.toml
118
136
  2. 持久信息存储使用`get/set`操作数据库
119
137
  3. 关键操作使用事务保证原子性
138
+ 4. 对于自定义事件循环,使用`exceptions.setup_async_loop()`方法确保异常被正确处理
120
139
  > 其中,1-2 步骤可以实现配合,比如硬配置让用户设置后,和数据库中的配置进行合并,实现配置的动态更新
121
140
 
122
141
  更多详细信息请参考[API文档](docs/api/)
123
142
 
143
+
124
144
  <!--- End of UseCore.md -->
125
145
 
126
146
  <!-- Adapter.md -->
@@ -894,7 +914,7 @@ def generate_message_id(platform: str, raw_id: str) -> str:
894
914
 
895
915
  # 📦 `ErisPulse.__init__` 模块
896
916
 
897
- <sup>自动生成于 2025-08-01 14:55:50</sup>
917
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
898
918
 
899
919
  ---
900
920
 
@@ -932,8 +952,7 @@ ErisPulse SDK 主模块
932
952
  <div class='admonition warning'><p class='admonition-title'>内部方法</p><p></p></div>
933
953
  准备运行环境
934
954
 
935
- 1. 初始化项目环境文件
936
- 2. 加载环境变量配置
955
+ 初始化项目环境文件
937
956
 
938
957
  :return: bool 环境准备是否成功
939
958
 
@@ -1204,13 +1223,13 @@ SDK初始化入口
1204
1223
 
1205
1224
  ---
1206
1225
 
1207
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1226
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1208
1227
 
1209
1228
  ## ErisPulse\__main__.md
1210
1229
 
1211
1230
  # 📦 `ErisPulse.__main__` 模块
1212
1231
 
1213
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1232
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1214
1233
 
1215
1234
  ---
1216
1235
 
@@ -1519,13 +1538,13 @@ ErisPulse命令行接口
1519
1538
 
1520
1539
  ---
1521
1540
 
1522
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1541
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1523
1542
 
1524
1543
  ## ErisPulse\Core\adapter.md
1525
1544
 
1526
1545
  # 📦 `ErisPulse.Core.adapter` 模块
1527
1546
 
1528
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1547
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1529
1548
 
1530
1549
  ---
1531
1550
 
@@ -1921,13 +1940,13 @@ OneBot12协议事件监听装饰器
1921
1940
 
1922
1941
  ---
1923
1942
 
1924
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1943
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1925
1944
 
1926
1945
  ## ErisPulse\Core\config.md
1927
1946
 
1928
1947
  # 📦 `ErisPulse.Core.config` 模块
1929
1948
 
1930
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1949
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1931
1950
 
1932
1951
  ---
1933
1952
 
@@ -1941,57 +1960,13 @@ ErisPulse 配置中心
1941
1960
 
1942
1961
  ---
1943
1962
 
1944
- ## 🛠️ 函数
1945
-
1946
- ### `_ensure_config_structure(config: Dict[str, Any])`
1947
-
1948
- 确保配置结构完整,补全缺失的配置项
1949
-
1950
- :param config: 当前配置
1951
- :return: 补全后的完整配置
1952
-
1953
- ---
1954
-
1955
- ### `get_config()`
1956
-
1957
- 获取当前配置,自动补全缺失的配置项并保存
1958
-
1959
- :return: 完整的配置字典
1960
-
1961
- ---
1962
-
1963
- ### `update_config(new_config: Dict[str, Any])`
1964
-
1965
- 更新配置,自动补全缺失的配置项
1966
-
1967
- :param new_config: 新的配置字典
1968
- :return: 是否更新成功
1969
-
1970
- ---
1971
-
1972
- ### `get_server_config()`
1973
-
1974
- 获取服务器配置,确保结构完整
1975
-
1976
- :return: 服务器配置字典
1977
-
1978
- ---
1979
-
1980
- ### `get_logger_config()`
1981
-
1982
- 获取日志配置,确保结构完整
1983
-
1984
- :return: 日志配置字典
1985
-
1986
- ---
1987
-
1988
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1963
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1989
1964
 
1990
1965
  ## ErisPulse\Core\env.md
1991
1966
 
1992
1967
  # 📦 `ErisPulse.Core.env` 模块
1993
1968
 
1994
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1969
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1995
1970
 
1996
1971
  ---
1997
1972
 
@@ -2324,90 +2299,124 @@ ErisPulse 环境配置模块
2324
2299
 
2325
2300
  ---
2326
2301
 
2327
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2302
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2328
2303
 
2329
- ## ErisPulse\Core\exceptions.md
2304
+ ## ErisPulse\Core\erispulse_config.md
2330
2305
 
2331
- # 📦 `ErisPulse.Core.exceptions` 模块
2306
+ # 📦 `ErisPulse.Core.erispulse_config` 模块
2332
2307
 
2333
- <sup>自动生成于 2025-08-01 14:55:50</sup>
2308
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
2334
2309
 
2335
2310
  ---
2336
2311
 
2337
2312
  ## 模块概述
2338
2313
 
2339
2314
 
2340
- ErisPulse 全局异常处理系统
2315
+ ErisPulse 框架配置管理
2341
2316
 
2342
- 提供统一的异常捕获和格式化功能,支持同步和异步代码的异常处理。
2317
+ 专门管理 ErisPulse 框架自身的配置项。
2343
2318
 
2344
2319
  ---
2345
2320
 
2346
2321
  ## 🛠️ 函数
2347
2322
 
2348
- ### `global_exception_handler(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
2323
+ ### `_ensure_erispulse_config_structure(config_dict: Dict[str, Any])`
2349
2324
 
2350
- 全局异常处理器
2325
+ 确保 ErisPulse 配置结构完整,补全缺失的配置项
2351
2326
 
2352
- :param exc_type: 异常类型
2353
- :param exc_value: 异常值
2354
- :param exc_traceback: 追踪信息
2327
+ :param config_dict: 当前配置
2328
+ :return: 补全后的完整配置
2355
2329
 
2356
2330
  ---
2357
2331
 
2358
- ### `async_exception_handler(loop: asyncio.AbstractEventLoop, context: Dict[str, Any])`
2332
+ ### `get_erispulse_config()`
2359
2333
 
2360
- 异步异常处理器
2334
+ 获取 ErisPulse 框架配置,自动补全缺失的配置项并保存
2361
2335
 
2362
- :param loop: 事件循环
2363
- :param context: 上下文字典
2336
+ :return: 完整的 ErisPulse 配置字典
2364
2337
 
2365
2338
  ---
2366
2339
 
2367
- ### `setup_async_exception_handler(loop: asyncio.AbstractEventLoop = None)`
2340
+ ### `update_erispulse_config(new_config: Dict[str, Any])`
2368
2341
 
2369
- 设置异步异常处理器
2342
+ 更新 ErisPulse 配置,自动补全缺失的配置项
2370
2343
 
2371
- :param loop: 事件循环,如果为None则使用当前事件循环
2344
+ :param new_config: 新的配置字典
2345
+ :return: 是否更新成功
2372
2346
 
2373
2347
  ---
2374
2348
 
2375
- ## 🏛️ 类
2349
+ ### `get_server_config()`
2350
+
2351
+ 获取服务器配置,确保结构完整
2376
2352
 
2377
- ### `class ExceptionHandler`
2353
+ :return: 服务器配置字典
2378
2354
 
2379
- 异常处理器类
2355
+ ---
2380
2356
 
2357
+ ### `get_logger_config()`
2381
2358
 
2382
- #### 🧰 方法
2359
+ 获取日志配置,确保结构完整
2360
+
2361
+ :return: 日志配置字典
2362
+
2363
+ ---
2364
+
2365
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2366
+
2367
+ ## ErisPulse\Core\exceptions.md
2368
+
2369
+ # 📦 `ErisPulse.Core.exceptions` 模块
2370
+
2371
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
2372
+
2373
+ ---
2374
+
2375
+ ## 模块概述
2376
+
2377
+
2378
+ ErisPulse 全局异常处理系统
2379
+
2380
+ 提供统一的异常捕获和格式化功能,支持同步和异步代码的异常处理。
2381
+
2382
+ ---
2383
2383
 
2384
- ##### `format_exception(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
2384
+ ## 🛠️ 函数
2385
+
2386
+ ### `global_exception_handler(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
2385
2387
 
2386
- 格式化异常信息
2388
+ 全局异常处理器
2387
2389
 
2388
2390
  :param exc_type: 异常类型
2389
2391
  :param exc_value: 异常值
2390
2392
  :param exc_traceback: 追踪信息
2391
- :return: 格式化后的异常信息
2392
2393
 
2393
2394
  ---
2394
2395
 
2395
- ##### `format_async_exception(exception: Exception)`
2396
+ ### `async_exception_handler(loop: asyncio.AbstractEventLoop, context: Dict[str, Any])`
2397
+
2398
+ 异步异常处理器
2399
+
2400
+ :param loop: 事件循环
2401
+ :param context: 上下文字典
2402
+
2403
+ ---
2404
+
2405
+ ### `setup_async_loop(loop: asyncio.AbstractEventLoop = None)`
2396
2406
 
2397
- 格式化异步异常信息
2407
+ 为指定的事件循环设置异常处理器
2398
2408
 
2399
- :param exception: 异常对象
2400
- :return: 格式化后的异常信息
2409
+ :param loop: 事件循环实例,如果为None则使用当前事件循环
2401
2410
 
2402
2411
  ---
2403
2412
 
2404
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2413
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2405
2414
 
2406
2415
  ## ErisPulse\Core\logger.md
2407
2416
 
2408
2417
  # 📦 `ErisPulse.Core.logger` 模块
2409
2418
 
2410
- <sup>自动生成于 2025-08-01 14:55:50</sup>
2419
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
2411
2420
 
2412
2421
  ---
2413
2422
 
@@ -2494,13 +2503,13 @@ ErisPulse 日志系统
2494
2503
 
2495
2504
  ---
2496
2505
 
2497
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2506
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2498
2507
 
2499
2508
  ## ErisPulse\Core\mods.md
2500
2509
 
2501
2510
  # 📦 `ErisPulse.Core.mods` 模块
2502
2511
 
2503
- <sup>自动生成于 2025-08-01 14:55:50</sup>
2512
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
2504
2513
 
2505
2514
  ---
2506
2515
 
@@ -2709,13 +2718,13 @@ ErisPulse 模块管理器
2709
2718
 
2710
2719
  ---
2711
2720
 
2712
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2721
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2713
2722
 
2714
2723
  ## ErisPulse\Core\router.md
2715
2724
 
2716
2725
  # 📦 `ErisPulse.Core.router` 模块
2717
2726
 
2718
- <sup>自动生成于 2025-08-01 14:55:50</sup>
2727
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
2719
2728
 
2720
2729
  ---
2721
2730
 
@@ -2823,6 +2832,6 @@ ErisPulse 路由系统
2823
2832
 
2824
2833
  ---
2825
2834
 
2826
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2835
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2827
2836
 
2828
2837
  <!--- End of API文档 -->
@@ -204,14 +204,34 @@ if module_config is None:
204
204
  config.setConfig("MyModule", {"MyKey": "MyValue"}) # 设置默认配置
205
205
  ```
206
206
 
207
+ ### 4. 异常处理模块(exceptions)
208
+ ```python
209
+ # ErisPulse提供了统一的异常处理机制,可以自动捕获和格式化异常信息
210
+ # 对于异步代码,可以为特定事件循环设置异常处理器
211
+
212
+ import asyncio
213
+ from ErisPulse.Core import exceptions
214
+
215
+ # 为当前运行的事件循环设置异常处理器
216
+ loop = asyncio.get_running_loop()
217
+ exceptions.setup_async_loop(loop)
218
+
219
+ # 或者不传参数,自动获取当前事件循环 || 但不建议这么做,因为运行主程序时可能使用了其他的异步库
220
+ exceptions.setup_async_loop()
221
+
222
+ # 这样设置后,异步代码中的未捕获异常会被统一处理并格式化输出
223
+ ```
224
+
207
225
  ### 建议
208
226
  1. 模块配置应使用`getConfig/setConfig`操作config.toml
209
227
  2. 持久信息存储使用`get/set`操作数据库
210
228
  3. 关键操作使用事务保证原子性
229
+ 4. 对于自定义事件循环,使用`exceptions.setup_async_loop()`方法确保异常被正确处理
211
230
  > 其中,1-2 步骤可以实现配合,比如硬配置让用户设置后,和数据库中的配置进行合并,实现配置的动态更新
212
231
 
213
232
  更多详细信息请参考[API文档](docs/api/)
214
233
 
234
+
215
235
  <!--- End of UseCore.md -->
216
236
 
217
237
  <!-- PlatformFeatures.md -->
@@ -795,7 +815,7 @@ ErisPulse 项目:
795
815
 
796
816
  # 📦 `ErisPulse.Core.adapter` 模块
797
817
 
798
- <sup>自动生成于 2025-08-01 14:55:50</sup>
818
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
799
819
 
800
820
  ---
801
821
 
@@ -1191,13 +1211,13 @@ OneBot12协议事件监听装饰器
1191
1211
 
1192
1212
  ---
1193
1213
 
1194
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1214
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1195
1215
 
1196
1216
  ## config.md
1197
1217
 
1198
1218
  # 📦 `ErisPulse.Core.config` 模块
1199
1219
 
1200
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1220
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1201
1221
 
1202
1222
  ---
1203
1223
 
@@ -1211,57 +1231,13 @@ ErisPulse 配置中心
1211
1231
 
1212
1232
  ---
1213
1233
 
1214
- ## 🛠️ 函数
1215
-
1216
- ### `_ensure_config_structure(config: Dict[str, Any])`
1217
-
1218
- 确保配置结构完整,补全缺失的配置项
1219
-
1220
- :param config: 当前配置
1221
- :return: 补全后的完整配置
1222
-
1223
- ---
1224
-
1225
- ### `get_config()`
1226
-
1227
- 获取当前配置,自动补全缺失的配置项并保存
1228
-
1229
- :return: 完整的配置字典
1230
-
1231
- ---
1232
-
1233
- ### `update_config(new_config: Dict[str, Any])`
1234
-
1235
- 更新配置,自动补全缺失的配置项
1236
-
1237
- :param new_config: 新的配置字典
1238
- :return: 是否更新成功
1239
-
1240
- ---
1241
-
1242
- ### `get_server_config()`
1243
-
1244
- 获取服务器配置,确保结构完整
1245
-
1246
- :return: 服务器配置字典
1247
-
1248
- ---
1249
-
1250
- ### `get_logger_config()`
1251
-
1252
- 获取日志配置,确保结构完整
1253
-
1254
- :return: 日志配置字典
1255
-
1256
- ---
1257
-
1258
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1234
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1259
1235
 
1260
1236
  ## env.md
1261
1237
 
1262
1238
  # 📦 `ErisPulse.Core.env` 模块
1263
1239
 
1264
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1240
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1265
1241
 
1266
1242
  ---
1267
1243
 
@@ -1594,90 +1570,124 @@ ErisPulse 环境配置模块
1594
1570
 
1595
1571
  ---
1596
1572
 
1597
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1573
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1598
1574
 
1599
- ## exceptions.md
1575
+ ## erispulse_config.md
1600
1576
 
1601
- # 📦 `ErisPulse.Core.exceptions` 模块
1577
+ # 📦 `ErisPulse.Core.erispulse_config` 模块
1602
1578
 
1603
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1579
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1604
1580
 
1605
1581
  ---
1606
1582
 
1607
1583
  ## 模块概述
1608
1584
 
1609
1585
 
1610
- ErisPulse 全局异常处理系统
1586
+ ErisPulse 框架配置管理
1611
1587
 
1612
- 提供统一的异常捕获和格式化功能,支持同步和异步代码的异常处理。
1588
+ 专门管理 ErisPulse 框架自身的配置项。
1613
1589
 
1614
1590
  ---
1615
1591
 
1616
1592
  ## 🛠️ 函数
1617
1593
 
1618
- ### `global_exception_handler(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
1594
+ ### `_ensure_erispulse_config_structure(config_dict: Dict[str, Any])`
1619
1595
 
1620
- 全局异常处理器
1596
+ 确保 ErisPulse 配置结构完整,补全缺失的配置项
1621
1597
 
1622
- :param exc_type: 异常类型
1623
- :param exc_value: 异常值
1624
- :param exc_traceback: 追踪信息
1598
+ :param config_dict: 当前配置
1599
+ :return: 补全后的完整配置
1625
1600
 
1626
1601
  ---
1627
1602
 
1628
- ### `async_exception_handler(loop: asyncio.AbstractEventLoop, context: Dict[str, Any])`
1603
+ ### `get_erispulse_config()`
1629
1604
 
1630
- 异步异常处理器
1605
+ 获取 ErisPulse 框架配置,自动补全缺失的配置项并保存
1631
1606
 
1632
- :param loop: 事件循环
1633
- :param context: 上下文字典
1607
+ :return: 完整的 ErisPulse 配置字典
1634
1608
 
1635
1609
  ---
1636
1610
 
1637
- ### `setup_async_exception_handler(loop: asyncio.AbstractEventLoop = None)`
1611
+ ### `update_erispulse_config(new_config: Dict[str, Any])`
1638
1612
 
1639
- 设置异步异常处理器
1613
+ 更新 ErisPulse 配置,自动补全缺失的配置项
1640
1614
 
1641
- :param loop: 事件循环,如果为None则使用当前事件循环
1615
+ :param new_config: 新的配置字典
1616
+ :return: 是否更新成功
1642
1617
 
1643
1618
  ---
1644
1619
 
1645
- ## 🏛️ 类
1620
+ ### `get_server_config()`
1621
+
1622
+ 获取服务器配置,确保结构完整
1623
+
1624
+ :return: 服务器配置字典
1646
1625
 
1647
- ### `class ExceptionHandler`
1626
+ ---
1648
1627
 
1649
- 异常处理器类
1628
+ ### `get_logger_config()`
1650
1629
 
1630
+ 获取日志配置,确保结构完整
1651
1631
 
1652
- #### 🧰 方法
1632
+ :return: 日志配置字典
1653
1633
 
1654
- ##### `format_exception(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
1634
+ ---
1655
1635
 
1656
- 格式化异常信息
1636
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1637
+
1638
+ ## exceptions.md
1639
+
1640
+ # 📦 `ErisPulse.Core.exceptions` 模块
1641
+
1642
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1643
+
1644
+ ---
1645
+
1646
+ ## 模块概述
1647
+
1648
+
1649
+ ErisPulse 全局异常处理系统
1650
+
1651
+ 提供统一的异常捕获和格式化功能,支持同步和异步代码的异常处理。
1652
+
1653
+ ---
1654
+
1655
+ ## 🛠️ 函数
1656
+
1657
+ ### `global_exception_handler(exc_type: Type[Exception], exc_value: Exception, exc_traceback: Any)`
1658
+
1659
+ 全局异常处理器
1657
1660
 
1658
1661
  :param exc_type: 异常类型
1659
1662
  :param exc_value: 异常值
1660
1663
  :param exc_traceback: 追踪信息
1661
- :return: 格式化后的异常信息
1662
1664
 
1663
1665
  ---
1664
1666
 
1665
- ##### `format_async_exception(exception: Exception)`
1667
+ ### `async_exception_handler(loop: asyncio.AbstractEventLoop, context: Dict[str, Any])`
1668
+
1669
+ 异步异常处理器
1670
+
1671
+ :param loop: 事件循环
1672
+ :param context: 上下文字典
1673
+
1674
+ ---
1675
+
1676
+ ### `setup_async_loop(loop: asyncio.AbstractEventLoop = None)`
1666
1677
 
1667
- 格式化异步异常信息
1678
+ 为指定的事件循环设置异常处理器
1668
1679
 
1669
- :param exception: 异常对象
1670
- :return: 格式化后的异常信息
1680
+ :param loop: 事件循环实例,如果为None则使用当前事件循环
1671
1681
 
1672
1682
  ---
1673
1683
 
1674
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1684
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1675
1685
 
1676
1686
  ## logger.md
1677
1687
 
1678
1688
  # 📦 `ErisPulse.Core.logger` 模块
1679
1689
 
1680
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1690
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1681
1691
 
1682
1692
  ---
1683
1693
 
@@ -1764,13 +1774,13 @@ ErisPulse 日志系统
1764
1774
 
1765
1775
  ---
1766
1776
 
1767
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1777
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1768
1778
 
1769
1779
  ## mods.md
1770
1780
 
1771
1781
  # 📦 `ErisPulse.Core.mods` 模块
1772
1782
 
1773
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1783
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1774
1784
 
1775
1785
  ---
1776
1786
 
@@ -1979,13 +1989,13 @@ ErisPulse 模块管理器
1979
1989
 
1980
1990
  ---
1981
1991
 
1982
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
1992
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
1983
1993
 
1984
1994
  ## router.md
1985
1995
 
1986
1996
  # 📦 `ErisPulse.Core.router` 模块
1987
1997
 
1988
- <sup>自动生成于 2025-08-01 14:55:50</sup>
1998
+ <sup>自动生成于 2025-08-02 01:50:12</sup>
1989
1999
 
1990
2000
  ---
1991
2001
 
@@ -2093,6 +2103,6 @@ ErisPulse 路由系统
2093
2103
 
2094
2104
  ---
2095
2105
 
2096
- <sub>文档最后更新于 2025-08-01 14:55:50</sub>
2106
+ <sub>文档最后更新于 2025-08-02 01:50:12</sub>
2097
2107
 
2098
2108
  <!--- End of API文档 -->