style(ai): rename unparseable to unparsable for codespell
Some checks failed
CI Code / Check spelling (pull_request) Successful in 14s
CI Code / Check coding style (pull_request) Failing after 23s
CI Code / Code Coverage (pull_request) Successful in 3m46s
CI Code / Linux (debian) (pull_request) Successful in 5m50s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m0s
CI Code / Linux (arch) (pull_request) Successful in 7m46s
Some checks failed
CI Code / Check spelling (pull_request) Successful in 14s
CI Code / Check coding style (pull_request) Failing after 23s
CI Code / Code Coverage (pull_request) Successful in 3m46s
CI Code / Linux (debian) (pull_request) Successful in 5m50s
CI Code / Linux (ubuntu) (pull_request) Successful in 6m0s
CI Code / Linux (arch) (pull_request) Successful in 7m46s
This commit is contained in:
@@ -2117,7 +2117,7 @@ _ai_request_thread(gpointer data)
|
||||
long first_reject_code = 0;
|
||||
/* Same for a 2xx we could not parse: the user must learn their endpoint
|
||||
* answered, even when the fallback attempt fails with its own error */
|
||||
auto_gchar gchar* first_unparseable_note = NULL;
|
||||
auto_gchar gchar* first_unparsable_note = NULL;
|
||||
auto_gchar gchar* content = NULL;
|
||||
gboolean first_endpoint_missing = FALSE;
|
||||
for (gint i = 0; i < n_attempts; i++) {
|
||||
@@ -2181,11 +2181,11 @@ _ai_request_thread(gpointer data)
|
||||
content = ai_parse_response_typed(used_type, response.data);
|
||||
if (!content && more && configured == AI_API_TYPE_AUTO
|
||||
&& http_code >= 200 && http_code < 300) {
|
||||
log_info("[AI-THREAD] %s returned an unparseable 2xx for '%s', trying %s",
|
||||
log_info("[AI-THREAD] %s returned an unparsable 2xx for '%s', trying %s",
|
||||
ai_api_type_to_string(used_type), local_provider_name,
|
||||
ai_api_type_to_string(attempts[i + 1]));
|
||||
if (!first_unparseable_note)
|
||||
first_unparseable_note = g_strdup_printf("%s endpoint answered HTTP %ld but the body could not be parsed",
|
||||
if (!first_unparsable_note)
|
||||
first_unparsable_note = g_strdup_printf("%s endpoint answered HTTP %ld but the body could not be parsed",
|
||||
ai_api_type_to_string(used_type), http_code);
|
||||
continue;
|
||||
}
|
||||
@@ -2215,8 +2215,8 @@ _ai_request_thread(gpointer data)
|
||||
first_note = g_strdup_printf("%s endpoint rejected the request with HTTP %ld: %s",
|
||||
ai_api_type_to_string(attempts[0]), first_reject_code,
|
||||
parsed ? parsed : first_reject_body);
|
||||
} else if (first_unparseable_note) {
|
||||
first_note = g_strdup(first_unparseable_note);
|
||||
} else if (first_unparsable_note) {
|
||||
first_note = g_strdup(first_unparsable_note);
|
||||
}
|
||||
auto_gchar gchar* error_msg = first_note
|
||||
? g_strdup_printf("%s (first attempt: %s)", curl_easy_strerror(res), first_note)
|
||||
@@ -2237,8 +2237,8 @@ _ai_request_thread(gpointer data)
|
||||
/* Try to extract the actual error message from the JSON response */
|
||||
auto_gchar gchar* parsed_error = ai_parse_error_message(err_body);
|
||||
auto_gchar gchar* error_msg = parsed_error ? g_strdup_printf("HTTP %ld: %s", err_code, parsed_error) : g_strdup_printf("HTTP %ld: %s", err_code, err_body && strlen(err_body) > 0 ? err_body : "Unknown error");
|
||||
if (first_unparseable_note) {
|
||||
gchar* with_note = g_strdup_printf("%s (first attempt: %s)", error_msg, first_unparseable_note);
|
||||
if (first_unparsable_note) {
|
||||
gchar* with_note = g_strdup_printf("%s (first attempt: %s)", error_msg, first_unparsable_note);
|
||||
g_free(error_msg);
|
||||
error_msg = with_note;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user