mirror of
https://github.com/tailscale/tailscale.git
synced 2025-06-29 19:48:38 +00:00
k8s-operator: adding more detail to error response
Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
parent
27f218e202
commit
46760d3f77
@ -6,6 +6,7 @@
|
|||||||
package sessionrecording
|
package sessionrecording
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@ -207,12 +208,16 @@ func connectV2(ctx context.Context, hc *http.Client, ap netip.AddrPort) (io.Writ
|
|||||||
defer close(acks)
|
defer close(acks)
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
defer pw.Close()
|
defer pw.Close()
|
||||||
dec := json.NewDecoder(resp.Body)
|
|
||||||
|
var bodyBuffer bytes.Buffer
|
||||||
|
teeReader := io.TeeReader(resp.Body, &bodyBuffer)
|
||||||
|
dec := json.NewDecoder(teeReader)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
var frame v2ResponseFrame
|
var frame v2ResponseFrame
|
||||||
if err := dec.Decode(&frame); err != nil {
|
if err := dec.Decode(&frame); err != nil {
|
||||||
if !errors.Is(err, io.EOF) {
|
if !errors.Is(err, io.EOF) {
|
||||||
errChan <- fmt.Errorf("recording: unexpected error receiving acks: %w", err)
|
errChan <- fmt.Errorf("recording: unexpected error receiving acks: unable to decode body %q: %w", bodyBuffer.String(), err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user