lib/zold/commands/fetch.rb in zold-0.22.3 vs lib/zold/commands/fetch.rb in zold-0.22.4
- old
+ new
@@ -168,12 +168,12 @@
if wallet.balance.negative? && !wallet.root?
raise "The balance of #{id} is #{wallet.balance} and it's not a root wallet"
end
copy = cps.add(IO.read(f), score.host, score.port, score.value, master: r.master?)
@log.info("#{r} returned #{wallet.mnemo} #{Age.new(json['mtime'])}/#{json['copies']}c \
- as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
- #{Rainbow(score.value).green} (#{json['version']})")
+as copy ##{copy}/#{cps.all.count} in #{Age.new(start, limit: 4)}: \
+#{Rainbow(score.value).green} (#{json['version']})")
end
end
score.value
end
end
@@ -181,9 +181,10 @@
def read_one(id, r, opts)
attempt = 0
begin
uri = "/wallet/#{id}"
head = r.http(uri).get
+ raise "The wallet #{id} doesn't exist at #{r}" if head.status == 404
r.assert_code(200, head)
json = JsonPage.new(head.body, uri).to_hash
score = Score.parse_json(json['score'])
yield json, score
rescue JsonPage::CantParse, Score::CantParse, RemoteNode::CantAssert => e