Compare commits
No commits in common. "72d062ac0dfade06b7f60c1fa2f7b3e439e801d6" and "1ad74669d661c6fbec8b2c4880cedd773da1359d" have entirely different histories.
72d062ac0d
...
1ad74669d6
2 changed files with 4 additions and 16 deletions
12
main.go
12
main.go
|
@ -67,10 +67,8 @@ func (r *ReadableStream) Close() (err error) {
|
|||
defer func() {
|
||||
// We don't want any errors to be thrown if the stream is already closed.
|
||||
recovery := recover()
|
||||
if !strings.Contains(fmt.Sprint(recovery), "Can not close stream after closing or error") {
|
||||
if recovery != nil {
|
||||
err = fmt.Errorf("panic: %v", recovery)
|
||||
}
|
||||
if !strings.Contains(recovery.(string), "Can not close stream after closing or error") {
|
||||
err = fmt.Errorf("panic: %v", recovery)
|
||||
}
|
||||
}()
|
||||
|
||||
|
@ -143,10 +141,8 @@ func (w *WritableStream) Close() (err error) {
|
|||
defer func() {
|
||||
// We don't want any errors to be thrown if the stream is already closed.
|
||||
recovery := recover()
|
||||
if !strings.Contains(fmt.Sprint(recovery), "Can not close stream after closing or error") {
|
||||
if recovery != nil {
|
||||
err = fmt.Errorf("panic: %v", recovery)
|
||||
}
|
||||
if !strings.Contains(recovery.(string), "Can not close stream after closing or error") {
|
||||
err = fmt.Errorf("panic: %v", recovery)
|
||||
}
|
||||
}()
|
||||
|
||||
|
|
|
@ -21,10 +21,6 @@ func main() {
|
|||
return
|
||||
}
|
||||
fmt.Println(string(buffer))
|
||||
err = readStream.Close()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
|
@ -38,10 +34,6 @@ func main() {
|
|||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
err = writeStream.Close()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue