Dodaj PublicationNotFound — jawny brak publikacji w PBN (422 + "was not exists!")#3
Merged
Merged
Conversation
get_publication_by_id mapuje HTTP 422 z markerem "was not exists!" (oryginalna pisownia błędu PBN) na PublicationNotFound(HttpException), zachowując status_code/url/content i łańcuch przyczyn (from e). Zwykły 404 celowo NIE jest mapowany — może być przejściowy i propaguje jako zwykły HttpException. Treść bytes dekodowana utf-8 (errors=replace) przed sprawdzeniem markera. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mpasternak
force-pushed
the
feat/pbn-publication-not-found
branch
from
July 14, 2026 17:19
1c3fc5b to
877bf17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Co robi
Dodaje wyjątek
PublicationNotFound(HttpException)i podnosi go zget_publication_by_id, gdy PBN jawnie sygnalizuje brak publikacji: HTTP 422 z markerem"was not exists!"w treści odpowiedzi (oryginalna pisownia błędu PBN; identyfikator w komunikacie jest zmienny, więc dopasowujemy sam marker).Szczegóły
src/pbn_client/exceptions.py: nowa klasaPublicationNotFound(HttpException), dopisana do__all__.src/pbn_client/__init__.py: eksportPublicationNotFound.src/pbn_client/mixins/publications.py:get_publication_by_idłapieHttpException; przy 422 + markerze re-raise jakoPublicationNotFound(e.status_code, e.url, e.content) from e. Treśćbytesdekodowana utf-8 (errors="replace") przed sprawdzeniem markera.PublicationNotFound— 404 bywa przejściowy i propaguje jako zwykłyHttpException. Tylko sygnał 422-z-markerem oznacza definitywny brak.Testy (
tests/test_publications.py)PublicationNotFound(status_code/url/content zachowane,__cause__ustawione),HttpException(NIEPublicationNotFound),HttpException,bytesz markerem →PublicationNotFound,issubclass(PublicationNotFound, HttpException)+ eksport z pakietu,Referencja: detekcja w monolicie BPP
src/pbn_integrator/utils/publications.py(_pobierz_pojedyncza_prace).uv run --isolated pytest -q→ 49 passed;ruff check/ruff format --checkczyste.🤖 Generated with Claude Code