Skip to content

Commit 5c732db

Browse files
committed
added more error handlers
1 parent 66e579c commit 5c732db

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

compute/src/reqres/task.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,14 @@ fn map_prompt_error_to_task_error(provider: ModelProvider, err: PromptError) ->
247247
"cuda_malloc_failed"
248248
} else if ollama_error.contains("CUDA error: out of memory") {
249249
"cuda_oom"
250+
} else if ollama_error.contains("API Error: Too Many Requests") {
251+
"api:too_many_requests"
252+
} else if ollama_error.contains("API Error: Bad Request") {
253+
"api:bad_request"
254+
} else if ollama_error.contains("not found, try pulling it first") {
255+
"model_not_pulled"
256+
} else if ollama_error.contains("Unexpected end of JSON input") {
257+
"unexpected_end_of_json"
250258
} else {
251259
"unknown"
252260
};
@@ -260,7 +268,10 @@ fn map_prompt_error_to_task_error(provider: ModelProvider, err: PromptError) ->
260268
),
261269
}
262270
// if we couldn't parse it, just return a generic prompt error
263-
.unwrap_or(TaskError::ExecutorError(err_inner.clone()))
271+
.unwrap_or(TaskError::ExecutorError(format!(
272+
"{provider} executor error: {}",
273+
err_inner.clone()
274+
)))
264275
}
265276
// if its a http error, we can try to parse it as well
266277
PromptError::CompletionError(CompletionError::HttpError(err_inner)) => {

0 commit comments

Comments
 (0)