error.go 482 B

123456789101112131415161718
  1. package ndr
  2. import "fmt"
  3. // Malformed implements the error interface for malformed NDR encoding errors.
  4. type Malformed struct {
  5. EText string
  6. }
  7. // Error implements the error interface on the Malformed struct.
  8. func (e Malformed) Error() string {
  9. return fmt.Sprintf("malformed NDR stream: %s", e.EText)
  10. }
  11. // Errorf formats an error message into a malformed NDR error.
  12. func Errorf(format string, a ...interface{}) Malformed {
  13. return Malformed{EText: fmt.Sprintf(format, a...)}
  14. }