diff --git a/src/git.xdrm.io/schastsp/server/server.go b/src/git.xdrm.io/schastsp/server/server.go index d0aa236..7b68c3e 100644 --- a/src/git.xdrm.io/schastsp/server/server.go +++ b/src/git.xdrm.io/schastsp/server/server.go @@ -84,14 +84,14 @@ func (s *T) HandleRequest(req io.Reader, res io.Writer) error { /* (1) Read x1 */ x1 := make([]byte, scha.HSIZE); read, err := req.Read(x1); - if err != nil { return err } - if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") } + if err != nil { return fmt.Errorf("Reading x1 : %s", err) } + if uint16(read) != scha.HSIZE { return fmt.Errorf("Cannot read x1 : %d / %d bytes available", read, scha.HSIZE) } /* (2) Read x2 */ x2 := make([]byte, scha.HSIZE); read, err = req.Read(x2); - if err != nil { return err } - if uint16(read) != scha.HSIZE { return errors.New("Cannot read enough bytes") } + if err != nil { return fmt.Errorf("Reading x2 : %s", err) } + if uint16(read) != scha.HSIZE { return fmt.Errorf("Cannot read x2 : %d / %d bytes available", read, scha.HSIZE) } /* (3) Manage request */ errCode, err := s.manageRequest(x1, x2)