edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

confusing "No such file or directory" error when mistyping an instance name in the CLI

Open zackelan opened this issue 2 years ago • 0 comments

EdgeDB CLI Version: EdgeDB CLI 3.0.0-dev (commit 827e801bef6593ab17a5c4bddb4fc2b6f25b1da3, master as of 2023-04-27)

Steps to Reproduce:

  1. link one or more remote instances:
$ edgedb instance list
┌────────┬─────────┬─────────────────┬─────────────────────┬────────┐
│ Kind   │ Name    │ Port            │ Version             │ Status │
├────────┼─────────┼─────────────────┼─────────────────────┼────────┤
│ remote │ edge214 │ localhost:25656 │ 2.14+2d99eed        │ up     │
│ remote │ edge30a │ localhost:35656 │ 3.0-alpha.3+5c80501 │ up     │
└────────┴─────────┴─────────────────┴─────────────────────┴────────┘
  1. run any CLI command that accepts -I and an instance name, and have a typo in the name of the instance:
$ edgedb -I egde30a
edgedb error: ClientError: cannot read credentials file /home/zack/.config/edgedb/credentials/egde30a.json: No such file or directory (os error 2)
$ edgedb ui -I egde30a
edgedb error: ClientError: cannot read credentials file /home/zack/.config/edgedb/credentials/egde30a.json: No such file or directory (os error 2)
$ edgedb dump -I egde30a db
edgedb error: ClientError: cannot read credentials file /home/zack/.config/edgedb/credentials/egde30a.json: No such file or directory (os error 2)

expected results:

a more user-friendly and high-level "instance does not exist" error, rather than a low-level error saying we couldn't find the credentials file (which is an implementation detail from the standpoint of a user who ran edgedb instance link as I did)

nice to have, "maybe you meant X?" output, similar to how git handles typos:

$ git statsu
git: 'statsu' is not a git command. See 'git --help'.

The most similar command is
        status

zackelan avatar Apr 27 '23 18:04 zackelan