Raise correct error in index store exists check

This commit is contained in:
lash 2022-05-04 18:37:02 +00:00
parent 3a8ec01588
commit 01ad409077
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 26 additions and 4 deletions

View File

@ -1,3 +1,15 @@
- 0.1.12
* Raise correct exception from index store exists check
- 0.1.11
* Allow for sync skip in store instantiation
- 0.1.10
* Improve logging
- 0.1.9
* Upgrade deps
- 0.1.8
* Upgrade deps
- 0.1.7
* Improve logging
- 0.1.6
* Sort upcoming queue item chronologically
* Add unit testing for upcoming query method

View File

@ -6,7 +6,10 @@ import logging
from leveldir.hex import HexDir
# local imports
from chainqueue.error import DuplicateTxError
from chainqueue.error import (
DuplicateTxError,
NotLocalTxError,
)
logg = logging.getLogger(__name__)
@ -22,7 +25,7 @@ class IndexStore(HexDir):
existing = None
try:
existing = self.get(k)
except FileNotFoundError:
except NotLocalTxError:
pass
return existing != None
@ -37,7 +40,14 @@ class IndexStore(HexDir):
def get(self, k):
fp = self.store.to_filepath(k)
f = open(fp, 'rb')
f = None
err = None
try:
f = open(fp, 'rb')
except FileNotFoundError as e:
err = e
if err != None:
raise NotLocalTxError(err)
v = f.read()
f.close()
return v.decode('utf-8')

View File

@ -1,6 +1,6 @@
[metadata]
name = chainqueue
version = 0.1.10
version = 0.1.12
description = Generic blockchain transaction queue control
author = Louis Holbrook
author_email = dev@holbrook.no