SendError

Type aliasin fsthttpcompute-sdk-go v1.11.0View source
type SendError = fastly.SendErrorDetail

Alias for fastly.SendErrorDetail.

SendError provides detailed information about backend request failures.

Use errors.As() to extract the SendError from the error chain, then use the Cause() method to determine the specific error cause.

Example usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
resp, err := req.Send(ctx, "backend")
if err != nil {
var se fsthttp.SendError
if errors.As(err, &se) {
switch se.Cause() {
case fsthttp.SendErrorConnectionTimeout:
log.Println("connection timed out")
case fsthttp.SendErrorDNSError:
log.Printf("DNS lookup failed: rcode=%d, info=%d", se.DNSErrorRCode(), se.DNSErrorInfoCode())
case fsthttp.SendErrorTLSAlertReceived:
log.Printf("TLS alert: %d (%s)", se.TLSAlertID(), se.TLSAlertDescription())
}
}
}