Skip to content

Commit

Permalink
debug: remove error assertions
Browse files Browse the repository at this point in the history
We inserted these while transitioning to the new API but we've never hit one.
  • Loading branch information
Stebalien committed Feb 19, 2019
1 parent 060c03a commit affc206
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 58 deletions.
7 changes: 0 additions & 7 deletions chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"sync"

"github.com/ipfs/go-ipfs-cmdkit"
"github.com/ipfs/go-ipfs-cmds/debug"
)

func NewChanResponsePair(req *Request) (ResponseEmitter, Response) {
Expand Down Expand Up @@ -130,12 +129,6 @@ func (re *chanResponseEmitter) Emit(v interface{}) error {
re.wl.Lock()
defer re.wl.Unlock()

// Initially this library allowed commands to return errors by sending an
// error value along a stream. We removed that in favour of CloseWithError,
// so we want to make sure we catch situations where some code still uses the
// old error emitting semantics and _panic_ in those situations.
debug.AssertNotError(v)

// unblock Length()
select {
case <-re.waitLen:
Expand Down
7 changes: 0 additions & 7 deletions cli/responseemitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"syscall"

"github.com/ipfs/go-ipfs-cmds"
"github.com/ipfs/go-ipfs-cmds/debug"
)

var _ ResponseEmitter = &responseEmitter{}
Expand Down Expand Up @@ -137,12 +136,6 @@ func (re *responseEmitter) Emit(v interface{}) error {
isSingle = true
}

// Initially this library allowed commands to return errors by sending an
// error value along a stream. We removed that in favour of CloseWithError,
// so we want to make sure we catch situations where some code still uses the
// old error emitting semantics and _panic_ in those situations.
debug.AssertNotError(v)

// channel emission iteration
if ch, ok := v.(chan interface{}); ok {
v = (<-chan interface{})(ch)
Expand Down
28 changes: 0 additions & 28 deletions debug/checkerr.go

This file was deleted.

7 changes: 0 additions & 7 deletions http/responseemitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/ipfs/go-ipfs-cmdkit"
cmds "github.com/ipfs/go-ipfs-cmds"
"github.com/ipfs/go-ipfs-cmds/debug"
)

var (
Expand Down Expand Up @@ -88,12 +87,6 @@ type responseEmitter struct {
}

func (re *responseEmitter) Emit(value interface{}) error {
// Initially this library allowed commands to return errors by sending an
// error value along a stream. We removed that in favour of CloseWithError,
// so we want to make sure we catch situations where some code still uses the
// old error emitting semantics and _panic_ in those situations.
debug.AssertNotError(value)

// if we got a channel, instead emit values received on there.
if ch, ok := value.(chan interface{}); ok {
value = (<-chan interface{})(ch)
Expand Down
9 changes: 0 additions & 9 deletions writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"sync"

"github.com/ipfs/go-ipfs-cmdkit"
"github.com/ipfs/go-ipfs-cmds/debug"
)

func NewWriterResponseEmitter(w io.WriteCloser, req *Request) (ResponseEmitter, error) {
Expand Down Expand Up @@ -154,14 +153,6 @@ func (re *writerResponseEmitter) Emit(v interface{}) error {
return EmitChan(re, ch)
}

// Initially this library allowed commands to return errors by sending an
// error value along a stream. We removed that in favour of CloseWithError,
// so we want to make sure we catch situations where some code still uses the
// old error emitting semantics.
// Also errors may occur both as pointers and as plain values, so we need to
// check both.
debug.AssertNotError(v)

if re.closed {
return ErrClosedEmitter
}
Expand Down

0 comments on commit affc206

Please sign in to comment.