graphql-python / graphql-python/graphql-core-legacy

Unable to locate original location of Exception

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

説明

In [executor.py](https://github.com/graphql-python/graphql-core/blob/master/graphql/execution/executor.py#L536), there is the following code:

```py
if isinstance(result, Exception):
raise GraphQLLocatedError(field_asts, original_error=result, path=path)
```

This appears to swallow the original error (`result`) as it doesn't appear in any tracebacks, leading me to lose my mind trying to work out where an error is actually being thrown. In my local install I have changed it to this in order to [chain the exceptions](https://www.python.org/dev/peps/pep-3134/):

```py
if isinstance(result, Exception):
raise GraphQLLocatedError(field_asts, original_error=result, path=path) from result
```

This gives me the full original exception's stack trace to look at when I'm debugging, and allows me to regain some sanity. I don't know if there any any knock-on effects though, which is why I didn't create this as a pull request. I'd love to hear your thoughts!

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

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

調査の方向性

536行目付近の graphql/execution/executor.py と、リンクされている PEP 3134 の例外チェーン動作を確認する。チェーンの結果によって GraphQLLocatedError の動作と traceback の出力が維持されるか、起こり得る波及効果も含めて確認する。既存のエラー処理を壊さずに変更が検証されれば完了とする。

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

評価

技術スタック
python
領域
api, backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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