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.
What:
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:
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.