Holger Hildebrandt | fa07499 | 2020-03-27 15:42:06 +0000 | [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 | } |