zed icon indicating copy to clipboard operation
zed copied to clipboard

Improve errors for failed "zapi load"

Open jameskerr opened this issue 2 years ago • 1 comments

I am trying to ingest data from standard in using zapi load. I'm getting an error that is hard to debug like so:

My command (without a -use):

echo '{hello: "world"}' | zapi load -

Output:

HEAD not specified: indicate with -use or run the "use" command

So I add my use (without a branch):

echo '{hello: "world"}' | zapi load -use Demo -

And I get the same error:

HEAD not specified: indicate with -use or run the "use" command

Finally, I add @main and it works.

echo '{hello: "world"}' | zapi load -use Demo@main -
21mrhnKXzluy8ZftzB6cuzqoZhE committed

It seems like this should either work without the branch name, or it should give an error saying, "Pool name provided but no branch. The -use value must be have the form pool@commit or pool@branch."

jameskerr avatar Dec 03 '21 19:12 jameskerr

We've improved significantly since this issue was opened. Here's a walk through the equivalent repro steps using current Zed commit 26dbda03:

$ zed -version
Version: v1.2.0-20-g26dbda03

$ ls -l ~/.zed_head
ls: /Users/phil/.zed_head: No such file or directory

$ echo '{hello: "world"}' | zed load -
empty pool and branch

$ echo '{hello: "world"}' | zed load -use Demo -
"Demo": pool not found

$ zed create Demo
pool created: Demo 2CXc43SnRlIK7D7shSKbT4DsB8N

$ echo '{hello: "world"}' | zed load -use Demo -
(12/1) 17B 17B/s
2CXc4Pev5XDs5zFlGBpQQKdSGKc committed

In conclusion:

  1. The zed load does now work without having to specify the branch name
  2. If we attempt to load to a pool that doesn't exist, we do now get the more helpful "Demo": pool not found error message
  3. For the first attempted load when there was neither -use specified nor a ~/.zed_head present, the empty pool and branch error message could probably be improved

I'll keep this one open while we discuss what might be done about that third item.

philrz avatar Jul 27 '22 20:07 philrz