In a discussion on IRC last night, it was brought up that our error messages kinda suck sometimes. I tend to agree (merkledag: not found).
To improve this, we can distinguish between a few different failure modes for common commands:
Then, if the daemon is offline, we can return something like:
data not found locally.
(for context, i also just read this article and enjoyed it)
Bringing to attention get
>ipfs get invalid
03:49:44.027 ERROR core/comma: received command error in:
goroutine 25 [running]:
runtime/debug.Stack(0x0, 0x0, 0xc042044780)
C:/Go/src/runtime/debug/stack.go:24 +0xae
github.com/ipfs/go-ipfs/core/commands/e.New(0x14619a0, 0xc042047ae0, 0x0, 0x0, 0x0, 0x0, 0x0)
C:/tmp/src/github.com/ipfs/go-ipfs/core/commands/e/error.go:29 +0x5d
github.com/ipfs/go-ipfs/core/commands.glob..func61.1(0x146dce0, 0xc04215df10, 0x1470320, 0xc0422aa180, 0x1476ac0, 0xc04214e600)
C:/tmp/src/github.com/ipfs/go-ipfs/core/commands/get.go:113 +0xb2
created by github.com/ipfs/go-ipfs/core/commands.glob..func61
C:/tmp/src/github.com/ipfs/go-ipfs/core/commands/get.go:108 +0x1e7
get.go:113
Fixing the merkeldag error messages was discused is in pr. https://github.com/ipfs/go-ipfs/pull/4099 which seams to have been abandoned. I will be happy to do what I discussed in that issue and take a pass at giving more informative error messages.
I spend some time working with this, I will create a p.r. in a few days once I figure out something I am reasonable happy with,
Error: merkledag: not found
centos 7
ipfs version 0.4.13
After daemon-ed, problem solved.
@Stebalien many things have changed but the merkledag: not found error remains the same.
I would assume that we can now take advantange of errors.Is() and wrap original NotFound errors on higher layers like NotFoundOffline. Do you have an idea of what the best approach would be to address this one?
That helps but isn't necessary. We can just fix this.
That helps but isn't necessary. We can just fix this.
It seems that proposed fixes so far have not suceeded to land. How do you want to fix it?
The proposed fix modified the core ErrNotFound error to say "we're offline". The correct solution would involve:
* Possibly changing the merkledag error text to "block not found".
Let's start here: https://github.com/ipfs/go-ipld-format/pull/55
Most helpful comment
After daemon-ed, problem solved.