It doesn't belong in GetBlock because GetBlock is also called from
PutBlock, which checks to see if a block exists before it writes it
again.
In other words, in the most common scenario (a PUT of a new block), Keep
should not print a bogus error message.
if err != nil {
// This type assertion is safe because the only errors
// GetBlock can return are CorruptError or NotFoundError.
+ if err == NotFoundError {
+ log.Printf("%s: not found, giving up\n", hash)
+ }
http.Error(resp, err.Error(), err.(*KeepError).HTTPCode)
return
}
}
}
- log.Printf("%s: not found on any volumes, giving up\n", hash)
return nil, NotFoundError
}