15 lines
426 B
Go
15 lines
426 B
Go
package errors
|
|
|
|
import "fmt"
|
|
|
|
// NumberExceedsBounds error is created when the number doesn't fit into the destination.
|
|
type NumberExceedsBounds struct {
|
|
Number int
|
|
Size byte
|
|
ExpectedSize byte
|
|
}
|
|
|
|
// Error generates the string representation.
|
|
func (err *NumberExceedsBounds) Error() string {
|
|
return fmt.Sprintf("Number %d needs %d bytes but the maximum is %d bytes", err.Number, err.Size, err.ExpectedSize)
|
|
}
|