Comments (4)
Traverse processing
# 处理特殊类型异常模板信息 -> backend/app/schemas/base.py: SCHEMA_ERROR_MSG_TEMPLATES
for sub_raw_error in raw_exc.raw_errors:
sub_raw_exc = sub_raw_error.exc
if isinstance(sub_raw_exc, (EnumMemberError, WrongConstantError)):
if getattr(sub_raw_exc, 'code') == 'enum':
sub_raw_exc.__dict__['permitted'] = ', '.join(repr(v.value) for v in sub_raw_exc.enum_values) # type: ignore # noqa: E501
else:
sub_raw_exc.__dict__['permitted'] = ', '.join(repr(v) for v in sub_raw_exc.permitted) # type: ignore # noqa: E501
# 处理异常信息
for error in raw_exc.errors()[:1]:
field = str(error.get('loc')[-1])
msg = error.get('msg')
message += (
f'{data.get(field, field) if field != "__root__" else ""} {msg}' + '.'
)
output:
{
"code": 422,
"msg": "请求参数非法: email 邮箱格式错误.",
"data": null
}
If there is no problem, I will submit pr
from fastapi_best_architecture.
Of course
I ignored this situation in the test.
from fastapi_best_architecture.
It is recommended to keep errors_len, which is used to beautify the output.
from fastapi_best_architecture.
There should be only one error, and each error should be resolved
from fastapi_best_architecture.
Related Issues (20)
- Algorithm bug traversal_to_tree HOT 4
- console log output missing time HOT 6
- Optimize role menu authorization logic
- UUID exception HOT 17
- how to make pytest passed HOT 2
- AccessMiddleware and OperaLogMiddleware cannot exist at the same time. HOT 4
- celery task exception HOT 8
- Argument 'value' has incorrect type (expected str, got UUID) HOT 1
- ✨ TODO HOT 7
- opera_log_middleware exception
- curd/base.py 有个问题 HOT 5
- 📣 Welcome aboard
- 建议新增代码生成功能 HOT 1
- some things HOT 1
- use pydantic EmailStr for email validation HOT 4
- demo 网站出问题了: 内部服务器错误。 HOT 5
- ✨ New backend architecture HOT 1
- Dynamic Configuration: Dynamic configuration of the system environment (site title, logo, filing, footer...)
- Nice project and some personal issue. HOT 2
- 安装过依赖之后,我直接在backend下面执行main.py报错,提示ModuleNotFoundError: No module named 'backend' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastapi_best_architecture.