log stream update failure

This commit is contained in:
Jack Robison 2018-10-25 17:51:17 -04:00
parent 196f3ba92d
commit 416472c5d8
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
3 changed files with 7 additions and 3 deletions

View file

@ -2295,7 +2295,7 @@ class Daemon(AuthJSONRPCServer):
except DecodeError as err:
# there was a problem with a metadata field, raise an error here rather than
# waiting to find out when we go to publish the claim (after having made the stream)
raise Exception("invalid publish metadata: %s" % err.message)
raise Exception(f"invalid publish metadata: {err}")
certificate = None
if channel_id or channel_name:

View file

@ -709,7 +709,9 @@ class SQLiteStorage:
"select claim_id from claim where claim_outpoint=?", current_associated_content
).fetchone()[0]
if current_associated_claim_id != new_claim_id:
raise Exception("invalid stream update")
raise Exception(
f"mismatching claim ids when updating stream {current_associated_claim_id} vs {new_claim_id}"
)
# update the claim associated to the file
transaction.execute("insert or replace into content_claim values (?, ?)", (stream_hash, claim_outpoint))

View file

@ -334,7 +334,9 @@ class ContentClaimStorageTests(StorageTest):
invalid_update_info['nout'] = 0
invalid_update_info['claim_id'] = "beef0002" * 5
invalid_update_outpoint = "%s:%i" % (invalid_update_info['txid'], invalid_update_info['nout'])
with self.assertRaisesRegex(Exception, "invalid stream update"):
with self.assertRaisesRegex(Exception, "mismatching claim ids when updating stream "
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeef "
"vs beef0002beef0002beef0002beef0002beef0002"):
yield self.storage.save_claims([invalid_update_info])
yield self.storage.save_content_claim(stream_hash, invalid_update_outpoint)
current_claim_info = yield self.storage.get_content_claim(stream_hash)