fix(pbn): 422 publication-not-exists rzucało TypeError#596
Merged
Conversation
…IDPracyPoStroniePBN `_pobierz_pojedyncza_prace` przy realnym 422-not-exists robiło `raise BrakIDPracyPoStroniePBN(e)`, ale ta klasa dziedziczy po HttpException (konstruktor `(status_code, url, content)`) — jednoargumentowe wywołanie kończyło się TypeError zanim właściwy wyjątek został podniesiony. Dodatkowo `e.content` bywa bytes (smart_content zwraca surowe bajty przy UnicodeDecodeError), przez co samo `... in e.content` rzucało TypeError jeszcze wcześniej. Fix: dekodujemy content do str przed membership-testem i przekazujemy (status_code, url, content) do BrakIDPracyPoStroniePBN. Repro-testy: 422 str, 422 bytes, zachowanie pól HTTP. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
_pobierz_pojedyncza_prace(src/pbn_integrator/utils/publications.py) przy odpowiedzi PBN 422 „…was not exists!" robiłoraise BrakIDPracyPoStroniePBN(e). Ta klasa dziedziczy poHttpExceptionz konstruktorem(status_code, url, content), więc jednoargumentowe wywołanie →TypeErrorzamiast właściwego wyjątku. Dodatkowoe.contentbywabytes(smart_contentzwraca surowe bajty przyUnicodeDecodeError), więc... in e.contentrzucałoTypeErrorjeszcze wcześniej.Fix
contentdostrprzed membership-testem (bytes-safe, dotyczy też gałęzi 500),raise BrakIDPracyPoStroniePBN(e.status_code, e.url, e.content).Testy
Repro (
test_pobierz_pojedyncza_prace.py): 422/str, 422/bytes, zachowanie pól HTTP. Przed fixem 3×TypeError, po fixie 3 passed.Pierwszy z serii Fazy 0 planu ekstrakcji PBN (#595).
🤖 Generated with Claude Code