graphql-python / graphql-python/graphene

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

オープン
#1,265 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
✨ enhancement
主要言語
Python
スター
8.2k
フォーク
818
PR マージ指標
30日以内にマージされた PR はありません

説明

**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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、graphql.execution.utils、promise、GraphQLLocatedError に示されている例外と traceback の処理を追跡し、報告されている Graphene の errors フィールドの挙動と比較します。GraphQL のエラーレスポンスを利用可能なまま、スタックトレースが抑制される例外を呼び出し元がどのように識別するかを定義します。要求されたケースのカバレッジを含め、挙動が設定可能で文書化されていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api, backend-api-design
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。