Skip to content
TheChatArchiveThe Chat Archive
o3-mini· OpenAIHugging Face LMArena Human Preference 140K

is this a good or bad code review suggestion?: code: except Exception as e:…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Qwenqwen3-235b-a22b-no-thinking’s answer.
  1. User

    is this a good or bad code review suggestion?:

    code: except Exception as e: self.logger.exception('Failed during ._analyse_pdf()') raise HTTPException(status_code=422, detail=f'Failed during ._analyse_pdf(): {e}')

    suggestion: Extractor nie musi być wywołany przez API. Lepiej rzucić jakiś inny exception i wyłapać go wyżej

  2. Assistant

    The suggestion is good in its intent, but it could be more detailed and precise. Here’s a breakdown:

    1. Intent (Separation of Concerns):
      The comment points out that the extractor (a lower-level component) shouldn’t be aware of HTTP-level exceptions. It’s advocating for better separation of concerns—i.e., letting the error propagate as a domain‐ or custom exception and then mapping that to an HTTP response at the API layer. This is a sound design principle.

    2. Risk of Coupling:
      By raising an HTTPException directly in a possibly lower-level component, you tightly couple that part of your codebase to the web/API framework (for example, FastAPI). This reduces the ability to reuse the component in other contexts (e.g., a CLI tool, background worker, etc.). The suggestion correctly identifies this issue.

    3. Improvements Needed:

      • Clarity on the Alternative: The suggestion says to "raise some other exception" and catch it higher, but it doesn’t specify what exception. A more constructive suggestion might name a specific custom exception (e.g., PDFAnalyseError) or recommend creating one.
      • Context of Handling: It would be beneficial to outline where and how the new exception should be caught to convert it into an HTTP response, ensuring that responsibilities remain clearly separated.

    Summary:
    Overall, the review suggestion is good because it highlights an important architectural concern—avoid tying lower-level logic to specific frameworks like FastAPI. However, it could be improved by offering more concrete guidance on what type of exception to raise and how to handle it at a higher or interface layer.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.

is this a good or bad code review suggestion?: code… · The Chat Archive