Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

feat: better error message on ipfs cat #1965

Closed
wants to merge 1 commit into from

Conversation

niinpatel
Copy link
Contributor

@niinpatel niinpatel commented Mar 28, 2019

resolves: #1145

The command ipfs cat <hash>/wrong-dir/wrong-file
previously returned error message: No such file

Following the suggestions given in this thread, I changed the error message to:
no file named "wrong-dir/wrong-file" under <hash>

Also, the CI check will fail because test case for this is in interface-ipfs-core. So we'll need to change the tests in interface-ipfs-core repo.

@niinpatel niinpatel changed the title feat: better error message on ipfs cat [WIP] feat: better error message on ipfs cat Mar 28, 2019
`ipfs cat <hash>/wrong-dir/wrong-file` previously
returned: 'No such file'.

this commit changes the error message to:
'no file named "wrong-dir/wrong-file" under <hash>'

License: MIT
Signed-off-by: Nitin Patel <nitinpatel278@gmail.com>
@niinpatel niinpatel changed the title [WIP] feat: better error message on ipfs cat feat: better error message on ipfs cat Mar 28, 2019
pull(
exporter(ipfsPath, self._ipld, options),
pull.filter(file => file.path === fileNameOrHash),
exporter(cid, self._ipld, options),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you export the CID not CID+path you'll have to traverse through the entire graph until you get to the path you were looking for. This could make cat VERY slow for big directories if the content is not in your repo already (and be slow anyway, even if it is).

cc @achingbrain

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 that - if you pass the path as well as the CID (e.g. /ipfs/Qmfoo/path/to/file.txt) the the unixfs exporter is smart enough to not load whole DAGs for sharded directories, etc which saves a load of time & bandwidth. Maybe this change is better made there?

@alanshaw
Copy link
Member

alanshaw commented May 8, 2019

Closing as this needs a better approach.

@alanshaw alanshaw closed this May 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should specify which link didn't exist on ipfs.cat
3 participants