Raise correct error in index store exists check
This commit is contained in:
parent
3a8ec01588
commit
01ad409077
12
CHANGELOG
12
CHANGELOG
@ -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
|
- 0.1.6
|
||||||
* Sort upcoming queue item chronologically
|
* Sort upcoming queue item chronologically
|
||||||
* Add unit testing for upcoming query method
|
* Add unit testing for upcoming query method
|
||||||
|
@ -6,7 +6,10 @@ import logging
|
|||||||
from leveldir.hex import HexDir
|
from leveldir.hex import HexDir
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from chainqueue.error import DuplicateTxError
|
from chainqueue.error import (
|
||||||
|
DuplicateTxError,
|
||||||
|
NotLocalTxError,
|
||||||
|
)
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -22,7 +25,7 @@ class IndexStore(HexDir):
|
|||||||
existing = None
|
existing = None
|
||||||
try:
|
try:
|
||||||
existing = self.get(k)
|
existing = self.get(k)
|
||||||
except FileNotFoundError:
|
except NotLocalTxError:
|
||||||
pass
|
pass
|
||||||
return existing != None
|
return existing != None
|
||||||
|
|
||||||
@ -37,7 +40,14 @@ class IndexStore(HexDir):
|
|||||||
|
|
||||||
def get(self, k):
|
def get(self, k):
|
||||||
fp = self.store.to_filepath(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()
|
v = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
return v.decode('utf-8')
|
return v.decode('utf-8')
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainqueue
|
name = chainqueue
|
||||||
version = 0.1.10
|
version = 0.1.12
|
||||||
description = Generic blockchain transaction queue control
|
description = Generic blockchain transaction queue control
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user