Adding GetNoBits error for the Get command

This commit is contained in:
Denis-Cosmin Nutiu 2017-10-20 18:32:06 +03:00
parent 24b0a634d8
commit 1673aac845
2 changed files with 7 additions and 3 deletions

View file

@ -41,10 +41,9 @@ func SendFile(c net.Conn, path string) (int, error) {
log.Println(err)
return 0, err
}
// How is this even possible?
// This happens when the user ties to get the current directory
if n == 0 {
log.Println("0 bits written for:", path)
return 0, nil
return 0, GetNoBitsError
}
return n, nil

View file

@ -19,3 +19,8 @@ var (
TooManyArguments = errors.New("Too many arguments.")
TooFewArguments = errors.New("Too few arguments.")
)
// Command Errors
var (
GetNoBitsError = errors.New("The file/directory contains zero bits!")
)