graphql-python / graphql-python/graphene

Can there be a way to mute stacktraces coming from certain exceptions?

Đang mở
#1,265 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
✨ enhancement
Ngôn ngữ chính
Python
Star
8.2k
Fork
818
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Is your feature request related to a problem? Please describe.**
Currently I'd get a stacktrace for every single validation that occurs:

```
2020-09-16 03:31:18.459 ERROR graphql.execution.utils 127.0.0.1 c7b7f54e-299d-478d-b3e3-ae2b5112921f : Traceback (most recent call last):
File "/Users/blei/myproject/venv/lib/python3.8/site-packages/promise/promise.py", line 489, in _resolve_from_executor
executor(resolve, reject)
File "/Users/blei/myproject/venv/lib/python3.8/site-packages/promise/promise.py", line 756, in executor
return resolve(f(*args, **kwargs))
File "/Users/blei/myproject/venv/lib/python3.8/site-packages/graphql/execution/middleware.py", line 75, in make_it_promise
return next(*args, **kwargs)
File "/usr/local/Cellar/python@3.8/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/Users/blei/myproject/my_app/graphql.py", line 14, in wrapper_decorator
return func(*args, **kwargs)
File "/Users/blei/myproject/my_app/graphql.py", line 310, in mutate
raise MyAppError('Something')
graphql.error.located_error.GraphQLLocatedError: Something

```

Which seems like it would take up a LOT of disk space if someone were malicious + spammed the same endpoint many times and thus taking up all the disk space on my server.

**Describe the solution you'd like**
I would like the ability to mute exceptions (or specifically, stacktraces) coming from certain exceptions.

**Describe alternatives you've considered**
I've tried adding in my own `errors` field it seems like Graphene just mutes it.

**Additional context**
I can alternatively just create an `error` field or something, but then in the frontend I have to write in logic to handle the `error`/et. al and the `errors` field.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách lần theo cách xử lý exception và traceback được thể hiện trong graphql.execution.utils, promise và GraphQLLocatedError, sau đó so sánh với hành vi của trường errors trong Graphene như đã được báo cáo. Xác định cách các bên gọi sẽ nhận diện những exception có stacktrace bị tắt, đồng thời vẫn giữ response lỗi GraphQL khả dụng; được xem là hoàn tất khi hành vi này có thể cấu hình và được ghi lại tài liệu, kèm coverage cho trường hợp được yêu cầu.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend-api-design
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.