Skip to content

Conversation

GuidoBelluomo
Copy link
Contributor

@GuidoBelluomo GuidoBelluomo commented Oct 11, 2024

What:

  • Bug Fix
  • New Feature

Description:

I've added the HTTP status code to ErrorException, so it's possible to ignore 404 errors for deleting files that don't exist, if desired. OpenAI doesn't provide an exhaustive enough error response for missing files that I can just quickly and universally check:

{
  "error": {
    "message": "No such File object: file-testFile",
    "type": "invalid_request_error",
    "param": "id",
    "code": null
  }
}

As you can see there's no easy error code for missing resources, parsing the message is a terrible idea, so exposing the HTTP status code (404 in this case) enables to perform such simple checks.

@GuidoBelluomo GuidoBelluomo changed the title Feature/http status in errors HTTP status in ErrorException Oct 11, 2024
@gehrisandro gehrisandro merged commit 2e62342 into openai-php:main Nov 12, 2024
@gehrisandro
Copy link
Collaborator

Hi @GuidoBelluomo

Thanks for you PR!

pindab0ter added a commit to pindab0ter/translation-checker that referenced this pull request Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants