[server] explicit errors
This commit is contained in:
parent
5bb3d0275a
commit
39c9d8169f
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue