aboutsummaryrefslogtreecommitdiff
path: root/format/sideband64k/errors.go
blob: c04d7caa4966674c8b5293934ff6bafb04e41d2e (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package sideband64k

import (
	"errors"
	"fmt"
)

var (
	// ErrTooLarge indicates a payload exceeds configured sideband data limits.
	ErrTooLarge = errors.New("sideband64k: payload too large")
	// ErrInvalidBand indicates a data frame has an invalid sideband designator.
	ErrInvalidBand = errors.New("sideband64k: invalid band designator")
)

// ProtocolError reports invalid side-band-64k framing.
type ProtocolError struct {
	Reason string
}

func (e *ProtocolError) Error() string {
	if e == nil {
		return "<nil>"
	}

	if e.Reason == "" {
		return "sideband64k: protocol error"
	}

	return fmt.Sprintf("sideband64k: protocol error: %s", e.Reason)
}