Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Improve exception handling in Flodesk::Client

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

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
ruby
領域
api, backend

調査の方向性

lib/flodesk.rb の Client#request から開始し、70–74 行付近にある戻り値の型チェックを調べます。response_body が存在しない場合の接続エラーの経路を確認し、呼び出し元の動作を更新して、既存の Flodesk 関連の specs を実行し、エラーが発生することと nil のケースで NoMethodError が発生しなくなったことを確認します。

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

説明

Currently we've got the following code in Client#request:

https://github.com/codebar/planner/blob/45fd9d14f91bbbc80c13412983b51d75ff285c57/lib/flodesk.rb#L128-L133

Make code nil-safe

This can result in a NoMethodError: undefined method '[]' for nil if there is an issue connecting to Flodesk and the response doesn't actually contain a message_body.

This could happen in production, but also can be a source of flaky tests as happened recently.

Proposing to make this nil-safe by using e.response_body&.['message']

Raise rather than return the exception

Currently this code is actually returning the FlodeskError rather than raising it.

Proposing to raise the exception instead, but note there's one place where we currently check the return type from the method that will need updating to reflect this change:

https://github.com/codebar/planner/blob/45fd9d14f91bbbc80c13412983b51d75ff285c57/lib/flodesk.rb#L70-L74

Mock out the client in tests

As a separate task we can take a look at mocking Flodesk::Client in the specs. → Fixed on https://github.com/codebar/planner/pull/2402

主要言語
Ruby
スター
104
フォーク
205
平均マージ
1日 8時間
マージ済み PR(30日)
67

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

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

はじめの一歩

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

codebar/planner のほかの issue

codebar/planner の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

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

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