Skip to content

Return status when failed calls #597

Description

@Thanatermesis

Issue

Cecli should return the exit status when fails, for example:

~ ❯❯❯ cecli mycode.c -m "do foo and bar"
────────────────────────────────────────────────────────────────────────────
litellm.MidStreamFallbackError: litellm.ServiceUnavailableError:
Vertex_ai_betaException -
{
  "error": {
    "code": 503,
    "message": "This model is currently experiencing high demand. Spikes in
demand are usually temporary. Please try again later.",
    "status": "UNAVAILABLE"
  }
}
 Original exception: ServiceUnavailableError:
litellm.ServiceUnavailableError: Vertex_ai_betaException -
{
  "error": {
    "code": 503,
    "message": "This model is currently experiencing high demand. Spikes in
demand are usually temporary. Please try again later.",
    "status": "UNAVAILABLE"
  }
}

Response parsing error.
~ ❯❯❯ echo $?
0
~ ❯❯❯

The return status should be 0 -only- when the command/tool has finished successfully, otherwise it should 1 for error, but is suggested to use different numbers to know the specific error happened, for example if someone wants to make a tool like this:

cecli file.c -m "foo bar"
returned="$?"

case "$returned" in
    87)   echo -e "high demand issues, try again in 5 min" ; ;;
    88)   echo -e "connection failed" ; ;;
    ....
esac

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions