Skip to content

body in APIError is never assigned #948

Closed
@cenhao

Description

@cenhao

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

In the APIError class, there is a body class variable. Based on the comment:

    ""The API response body.

    If the API responded with a valid JSON structure then this property will be the
    decoded result.

    If it isn't a valid JSON structure then this will be the raw response.

    If there was no response associated with this error then it will be `None`.
    """

This class variable should contain the body of the response. However in the __init__ function, the body variable is not assigned and kept.

To Reproduce

Simply error.body will result in:

AttributeError: 'XxxxxxError' object has no attribute 'body'

Code snippets

No response

OS

OS agnostic

Python version

Python version agnostic

Library version

Lib version agnostic

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions