Go-ipfs: Better error messages

Created on 22 Nov 2017  路  10Comments  路  Source: ipfs/go-ipfs

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:

  1. Cannot find any providers for the given hash
  2. Cannot connect to any providers for the given hash
  3. MERKLEDAG: NOT FOUND (or maybe: failed to find hash)

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)

statuin-progress

Most helpful comment

After daemon-ed, problem solved.

All 10 comments

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:

  • Checking for this error inside the CoreAPI functions themselves, then checking to see if we're offline, then wrapping the error with a hint.
  • Possibly changing the merkledag error text to "block not found".
  • Wrapping the error inside go-unixfs to indicate that a part of the file was not found.
* Possibly changing the merkledag error text to "block not found".

Let's start here: https://github.com/ipfs/go-ipld-format/pull/55

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonchoi picture jonchoi  路  3Comments

slrslr picture slrslr  路  3Comments

JesseWeinstein picture JesseWeinstein  路  4Comments

daviddias picture daviddias  路  3Comments

lidel picture lidel  路  3Comments