From 922d30a4a680ff60a1fe64554c4f7c1a6e8d305f Mon Sep 17 00:00:00 2001 From: cruldra Date: Mon, 31 Mar 2025 16:37:05 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Python/Web/.cursorrules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Python/Web/.cursorrules | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Python/Web/.cursorrules b/Python/Web/.cursorrules index 23df9de..8e4fc6f 100644 --- a/Python/Web/.cursorrules +++ b/Python/Web/.cursorrules @@ -35,11 +35,9 @@ description: Python Web开发最佳实践与规范 │ ├── __init__.py │ ├── routes.py # 路由 │ ├── schemas.py # Pydantic模型 - │ └── crud.py # 数据库操作 │ └── utils.py # 工具函数 ├── api # 接口 │ ├── __init__.py - │ ├── crud.py # 数据库操作 │ ├── routes.py # 路由 │ ├── schemas.py # Pydantic模型 │ └── utils.py # 工具函数 @@ -90,6 +88,7 @@ description: Python Web开发最佳实践与规范 - 使用[wrapt](https://wrapt.readthedocs.io/en/latest/)库创建装饰器 - 装饰器应位于`$PROJECT_ROOT/app/$MODULE_NAME/utils.py`文件中 -## 函数返回值 +## 异常处理 -- 函数返回值应使用`returns`库 +- 除非特别说明,否则不要捕获任何异常 +- 在`$PROJECT_ROOT/app/core/exceptions.py`文件中创建自定义异常类