edgedb-cli
edgedb-cli copied to clipboard
`edgedb instance unlink` should give a better error message if the instance doesn't exist
- EdgeDB Version: n/a
- EdgeDB CLI Version:
EdgeDB CLI 5.2.0-dev(ae5516f1f40e87e64c8ec848c6267644563c5899-masteras of 2024-05-13) - OS Version:
NixOS 23.11.6827.383ffe076d9b
steps to reproduce:
- start an instance that is eligible for remote linking - eg
docker run -d --name edgedb52 -e EDGEDB_SERVER_SECURITY=insecure_dev_mode -p 5656:5656 edgedb/edgedb:5.2 - link it using the CLI:
edgedb -P 5656 instance link --trust-tls-cert docker-52 - run some testing, then unlink the instance, but with a typo in the instance name (in my case, I left out the hyphen)
current behavior:
> edgedb instance unlink -I docker52
edgedb error: cannot unlink docker52: No such file or directory (os error 2)
> edgedb instance unlink -I docker52 --force
edgedb error: cannot unlink docker52: No such file or directory (os error 2)
expected behavior:
translate the "no such file or directory" error into an "instance is not linked" message or something similar
in my case, I had killed the Docker container first, then attempted to unlink, and I wasn't sure if that was the cause of the error because the "no such file or directory" error isn't specific about which file or directory doesn't exist. I had to use strace to figure it out:
unlink("/home/zack/.config/edgedb/credentials/docker52.json") = -1 ENOENT (No such file or directory)
futex(0x6400be1b9070, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "\33[38;5;9;1medgedb error:\33[0m can"..., 92edgedb error: cannot unlink docker52: No such file or directory (os error 2)
) = 92