Skip to content

Better error handling when not using exceptions #23

@dgm3333

Description

@dgm3333

Using VS 2022
The following response from OpenAI triggers a fatal but silent throw.
Errors would be better handled by setting an error flag and storing the output for user handling or allowing user-definition of an error handling callback (or at the very least reporting the issue before crashing).

Response is:
{
  "error": {
    "code": null,
    "message": "You exceeded your current quota, please check your plan and billing details.",
    "param": null,
    "type": "insufficient_quota"
  }
}
    void trigger_error(const std::string& msg) {
//        if (throw_exception_) {
//            throw std::runtime_error(msg);
//        }
//        else {
            std::cerr << "[OpenAI] error. Reason: " << msg << '\n';
//        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions