Scott Baker | 2c1c482 | 2019-10-16 11:02:41 -0700 | [diff] [blame] | 1 | package ndr |
| 2 | |
| 3 | import "fmt" |
| 4 | |
| 5 | // Malformed implements the error interface for malformed NDR encoding errors. |
| 6 | type Malformed struct { |
| 7 | EText string |
| 8 | } |
| 9 | |
| 10 | // Error implements the error interface on the Malformed struct. |
| 11 | func (e Malformed) Error() string { |
| 12 | return fmt.Sprintf("malformed NDR stream: %s", e.EText) |
| 13 | } |
| 14 | |
| 15 | // Errorf formats an error message into a malformed NDR error. |
| 16 | func Errorf(format string, a ...interface{}) Malformed { |
| 17 | return Malformed{EText: fmt.Sprintf(format, a...)} |
| 18 | } |