quicError ensures err is an AlertError. If err is not already, quicError wraps it with alertInternalError.
(err error)
| 357 | // quicError ensures err is an AlertError. |
| 358 | // If err is not already, quicError wraps it with alertInternalError. |
| 359 | func quicError(err error) error { |
| 360 | if err == nil { |
| 361 | return nil |
| 362 | } |
| 363 | var ae AlertError |
| 364 | if errors.As(err, &ae) { |
| 365 | return err |
| 366 | } |
| 367 | var a alert |
| 368 | if !errors.As(err, &a) { |
| 369 | a = alertInternalError |
| 370 | } |
| 371 | // Return an error wrapping the original error and an AlertError. |
| 372 | // Truncate the text of the alert to 0 characters. |
| 373 | return fmt.Errorf("%w%.0w", err, AlertError(a)) |
| 374 | } |
| 375 | |
| 376 | func (c *Conn) quicReadHandshakeBytes(n int) error { |
| 377 | for c.hand.Len() < n { |
no test coverage detected
searching dependent graphs…