graphprotocol / graphprotocol/graph-node

Add useful error messages/types to Result<T, ()>

オープン
#3,247 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

error-handling good first issue
主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

説明

There are multiple functions that return Result<T, ()> in the code, this is equivalent to Option<T>, however instead of changing those to optional types, these should return useful error messages/types so it's easier to debug.

Example: https://github.com/graphprotocol/graph-node/blob/79390c39a13f166999ceea8defc55eedd05265ab/graph/src/data/subgraph/mod.rs#L169

Some of them could just return &str/String but preferably they should return a proper error type or just an instance of anyhow. If for any of them you decide to create new error types, consider using the crate thiserror 🙂

If you never used any of these crates mentioned above, take a look at our codebase, you'll find usages of both. And if you're doing something outside of the graph crate/folder, you might want to import those from it's prelude module.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた例の graph/src/data/subgraph/mod.rs から始め、次にコードベース内で Result<T, ()> を返す関数を検索します。既存の anyhow と thiserror の使用箇所を確認し、有用なエラーメッセージや型を決定する前に、各候補の失敗ケースを整理します。完了の条件は、特定したコードパス全体で、関連する unit 風の結果がエラー情報を破棄しなくなることです。

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

評価

技術スタック
rust
領域
backend
issue の種類
リファクタリング
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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