autogen icon indicating copy to clipboard operation
autogen copied to clipboard

Improve message error when docker isn't running (#3816)

Open gziz opened this issue 1 year ago • 0 comments

Why are these changes needed?

When docker is not running and the user tries to use DockerCommandLineCodeExecutort he displayed error is:

“Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory’))”

which is indeed not very helpful.

I initially searched for a built-in method in the docker library to determine whether the Docker daemon is running, but unfortunately, there’s none.

The next issue is that there isn’t a specific exception that exclusively covers the scenario where the daemon is not running. Hence, we rely on catching the DockerException, which seems to encompass this case and potentially others.

Because of this, I’m raising the custom message “Please ensure Docker is installed and running” only if the string “FileNotFoundError” is in the error message.

If this string is not in e, then I raise the error as usual, ensuring the user receives appropriate feedback based on the specific scenario.

Related issue number

#3816

Checks

  • [ ] I've included any doc changes needed for https://microsoft.github.io/autogen/. See https://microsoft.github.io/autogen/docs/Contribute#documentation to build and test documentation locally.
  • [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR.
  • [ ] I've made sure all auto checks have passed.

gziz avatar Dec 07 '24 06:12 gziz