NotFoundException too general to catch
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra việc xử lý ngoại lệ tại src/RetryStrategy/ApiWrapper.php:217 và đường dẫn yêu cầu recommendation trong src/RecommendClient.php:85. Tái hiện yêu cầu đối với một index hiện có nhưng chưa có model đã được huấn luyện, so sánh với phản hồi đối với index không tồn tại, và xác nhận rằng các caller có thể phân biệt hai trường hợp mà không cần phân tích các message.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
- 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.
- Ngôn ngữ chính
- PHP
- Star
- 697
- Fork
- 111
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của algolia/algoliasearch-client-php
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
[bug]: Please tag a new major version when introducing BC breaksCó thể làm lại được @Fluf22 đã nhận 216 ngày trước và không có pull request nào đang mở. Đang mở
algolia/algoliasearch-client-php#760 · 5 bình luận · 1 reaction · 1 người được giao ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
algolia/algoliasearch-client-php#753 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
[bug]: Use enumsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
algolia/algoliasearch-client-php#748 · 1 bình luận ·
Tất cả issue của algolia/algoliasearch-client-php
Issue tương tự
-
OpenRouter errors returned in a 200 body are thrown as a plain AiExceptionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
freescout-help-desk/freescout#5844 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Перевод устарел
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày