mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/storage: Add explicit error on unsynced resource
This commit is contained in:
parent
a422d195bc
commit
4625dd9986
1 changed files with 4 additions and 2 deletions
|
|
@ -247,8 +247,10 @@ func (self *ResourceHandler) GetLastPeriod(name string) (uint32, error) {
|
||||||
|
|
||||||
func (self *ResourceHandler) GetVersion(name string) (uint32, error) {
|
func (self *ResourceHandler) GetVersion(name string) (uint32, error) {
|
||||||
rsrc := self.getResource(name)
|
rsrc := self.getResource(name)
|
||||||
if rsrc == nil || !rsrc.isSynced() {
|
if rsrc == nil {
|
||||||
return 0, NewResourceError(ErrNotFound, "Resource does not exist or is not synced")
|
return 0, NewResourceError(ErrNotFound, "Resource does not exist")
|
||||||
|
} else if !rsrc.isSynced() {
|
||||||
|
return 0, NewResourceError(ErrNotSynced, "Resource is not synced")
|
||||||
}
|
}
|
||||||
return rsrc.version, nil
|
return rsrc.version, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue