From 416472c5d883088dc520ba16f1965907f9c9d183 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Thu, 25 Oct 2018 17:51:17 -0400 Subject: [PATCH] log stream update failure --- lbrynet/daemon/Daemon.py | 2 +- lbrynet/database/storage.py | 4 +++- tests/unit/database/test_SQLiteStorage.py | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lbrynet/daemon/Daemon.py b/lbrynet/daemon/Daemon.py index 2cd0fb0de..33faa1f7c 100644 --- a/lbrynet/daemon/Daemon.py +++ b/lbrynet/daemon/Daemon.py @@ -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: diff --git a/lbrynet/database/storage.py b/lbrynet/database/storage.py index 3e8900bd0..56643d0de 100644 --- a/lbrynet/database/storage.py +++ b/lbrynet/database/storage.py @@ -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)) diff --git a/tests/unit/database/test_SQLiteStorage.py b/tests/unit/database/test_SQLiteStorage.py index 60d61aa11..ce2783932 100644 --- a/tests/unit/database/test_SQLiteStorage.py +++ b/tests/unit/database/test_SQLiteStorage.py @@ -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)