Skip to content

Commit affc206

Browse files
committed
debug: remove error assertions
We inserted these while transitioning to the new API but we've never hit one.
1 parent 060c03a commit affc206

File tree

5 files changed

+0
-58
lines changed

5 files changed

+0
-58
lines changed

chan.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"sync"
77

88
"github.com/ipfs/go-ipfs-cmdkit"
9-
"github.com/ipfs/go-ipfs-cmds/debug"
109
)
1110

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

133-
// Initially this library allowed commands to return errors by sending an
134-
// error value along a stream. We removed that in favour of CloseWithError,
135-
// so we want to make sure we catch situations where some code still uses the
136-
// old error emitting semantics and _panic_ in those situations.
137-
debug.AssertNotError(v)
138-
139132
// unblock Length()
140133
select {
141134
case <-re.waitLen:

cli/responseemitter.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"syscall"
1010

1111
"github.com/ipfs/go-ipfs-cmds"
12-
"github.com/ipfs/go-ipfs-cmds/debug"
1312
)
1413

1514
var _ ResponseEmitter = &responseEmitter{}
@@ -137,12 +136,6 @@ func (re *responseEmitter) Emit(v interface{}) error {
137136
isSingle = true
138137
}
139138

140-
// Initially this library allowed commands to return errors by sending an
141-
// error value along a stream. We removed that in favour of CloseWithError,
142-
// so we want to make sure we catch situations where some code still uses the
143-
// old error emitting semantics and _panic_ in those situations.
144-
debug.AssertNotError(v)
145-
146139
// channel emission iteration
147140
if ch, ok := v.(chan interface{}); ok {
148141
v = (<-chan interface{})(ch)

debug/checkerr.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

http/responseemitter.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010

1111
"github.com/ipfs/go-ipfs-cmdkit"
1212
cmds "github.com/ipfs/go-ipfs-cmds"
13-
"github.com/ipfs/go-ipfs-cmds/debug"
1413
)
1514

1615
var (
@@ -88,12 +87,6 @@ type responseEmitter struct {
8887
}
8988

9089
func (re *responseEmitter) Emit(value interface{}) error {
91-
// Initially this library allowed commands to return errors by sending an
92-
// error value along a stream. We removed that in favour of CloseWithError,
93-
// so we want to make sure we catch situations where some code still uses the
94-
// old error emitting semantics and _panic_ in those situations.
95-
debug.AssertNotError(value)
96-
9790
// if we got a channel, instead emit values received on there.
9891
if ch, ok := value.(chan interface{}); ok {
9992
value = (<-chan interface{})(ch)

writer.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"sync"
99

1010
"github.com/ipfs/go-ipfs-cmdkit"
11-
"github.com/ipfs/go-ipfs-cmds/debug"
1211
)
1312

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

157-
// Initially this library allowed commands to return errors by sending an
158-
// error value along a stream. We removed that in favour of CloseWithError,
159-
// so we want to make sure we catch situations where some code still uses the
160-
// old error emitting semantics.
161-
// Also errors may occur both as pointers and as plain values, so we need to
162-
// check both.
163-
debug.AssertNotError(v)
164-
165156
if re.closed {
166157
return ErrClosedEmitter
167158
}

0 commit comments

Comments
 (0)