Error Handling Issue: Updating Response Status in Python’s Runpod
Hello everyone! I encountered an issue where I need to raise an error in my handler, but I’ve found that in the Python’s runpod library, errors are added to a
job_output
list. There’s a condition where it searches for the error
field to update the response status to FAILED
. However, since the error is within an output list, it doesn’t recognize that field, and the status remains COMPLETED
.
This is my handler and here is where I raise the error
and this is the Runpod code
Any insights would be greatly appreciated!4 Replies
is it only for the testing or it happens in endpointz
Try to throw the exception instead of yielding it
Yeah if you throw the exception, the SDK will handle it automatically, probably has something to do with yielding the error, I haven't had experience with that.
Thanks for the answers, I was guiding me by the runpod doc https://docs.runpod.io/serverless/workers/handlers/handler-error-handling to implement a custom error response. I going to keep trying.
Handling Errors | RunPod Documentation
Learn how to handle exceptions and implement custom error responses in your RunPod SDK handler function, including how to validate input and return customized error messages.
Its between yield / return keyword, they both work differently in the handler
but if you're using generator try to just throw the exception