NotFoundException too general to catch
まだ誰も着手していません。
評価
調査の方向性
まず、src/RetryStrategy/ApiWrapper.php:217 の例外処理と、src/RecommendClient.php:85 の推薦リクエスト経路を調査します。学習済みモデルのない既存のインデックスに対するリクエストを再現し、存在しないインデックスに対するレスポンスと比較して、呼び出し元がメッセージを解析せずに2つのケースを区別できることを確認します。
索引モデルが issue の本文から書いたものです。
説明
- Algolia Client Version: 3.2.0
- Language Version: 7.4
Description
Hi there,
I'm using the client to retrieve product recommendations based on the bought-together and related-products models.
Some of our indexes don't have enough events to train models so they shouldn't be used for recommendations, but it's possible that we misconfigure this somewhere, or that the number of events drops for indexes that did have enough events at some point.
Where there's no trained model (but the index does exist) I get the following exception:
(stack trace limited to vendor namespace only)
Fatal error: Uncaught Algolia\AlgoliaSearch\Exceptions\NotFoundException: Index ai_recommend_webshop-products-se:related-products.indice.bin does not exist in ./vendor/algolia/algoliasearch-client-php/src/RetryStrategy/ApiWrapper.php:217
Stack trace:
#0 ./vendor/algolia/algoliasearch-client-php/src/RetryStrategy/ApiWrapper.php(167): Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->handleResponse()
#1 ./vendor/algolia/algoliasearch-client-php/src/RetryStrategy/ApiWrapper.php(101): Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->request()
#2 ./vendor/algolia/algoliasearch-client-php/src/RecommendClient.php(85): Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->write()
thrown in ./vendor/algolia/algoliasearch-client-php/src/RetryStrategy/ApiWrapper.php on line 217
I would like to catch this kind of exception, but it is identical in type to the exception I get when the index doesn't exist:
Fatal error: Uncaught Algolia\AlgoliaSearch\Exceptions\NotFoundException: Index does not exist in ./vendor/algolia/algoliasearch-client-php/src/RetryStrategy/ApiWrapper.php:217
Ideally this would be a different kind of exception so my code can handle missing/untrained models but doesn't handle missing indexes since that's a much more grave error.
Attempting to parse the exception message seems a little unreliable, as those messages might change without us noticing.
Steps To Reproduce
- Request a recommendation from an existing index without a trained model.
- 主要言語
- PHP
- スター
- 697
- フォーク
- 111
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
algolia/algoliasearch-client-php のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
[bug]: Please tag a new major version when introducing BC breaks再び着手できるかも @Fluf22 が 216 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
algolia/algoliasearch-client-php#760 · コメント 5 件 · リアクション 1 件 · 担当者 1 名 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
algolia/algoliasearch-client-php#753 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
[bug]: Use enumsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
algolia/algoliasearch-client-php#748 · コメント 1 件 ·
algolia/algoliasearch-client-php の issue をすべて見る
似ている issue
-
OpenRouter errors returned in a 200 body are thrown as a plain AiException対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
freescout-help-desk/freescout#5844 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Перевод устарел
難易度 2/5 1〜2日 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信