(feat) replicate exception mapping

This commit is contained in:
ishaan-jaff 2023-11-10 09:44:59 -08:00
parent 00e1b46e68
commit 49c7c851a8

View file

@ -129,7 +129,7 @@ def handle_prediction_response(prediction_url, api_token, print_verbose):
logs = response_data.get("logs", "") logs = response_data.get("logs", "")
if status == "failed": if status == "failed":
replicate_error = response_data.get("error", "") replicate_error = response_data.get("error", "")
raise ReplicateError(status_code=500, message=f"Error: {replicate_error}, \n Replicate logs{logs}") raise ReplicateError(status_code=400, message=f"Error: {replicate_error}, \nReplicate logs:{logs}")
else: else:
# this can fail temporarily but it does not mean the replicate request failed, replicate request fails when status=="failed" # this can fail temporarily but it does not mean the replicate request failed, replicate request fails when status=="failed"
print_verbose("Replicate: Failed to fetch prediction status and output.") print_verbose("Replicate: Failed to fetch prediction status and output.")