mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 00:30:33 +03:00
Replace AssertionErrors with ValueError
AssertionError comes from `assert`s, using it for this doesn't make sense as we're complaining about values
This commit is contained in:
parent
fd3a4852f2
commit
ed9c1c6774
@ -45,7 +45,7 @@ def addcommodities(data):
|
|||||||
|
|
||||||
if old and companion.category_map.get(commodity['categoryname'], True):
|
if old and companion.category_map.get(commodity['categoryname'], True):
|
||||||
if new['symbol'] != old['symbol'] or new['name'] != old['name']:
|
if new['symbol'] != old['symbol'] or new['name'] != old['name']:
|
||||||
raise AssertionError('{}: {!r} != {!r}'.format(key, new, old))
|
raise ValueError('{}: {!r} != {!r}'.format(key, new, old))
|
||||||
|
|
||||||
commodities[key] = new
|
commodities[key] = new
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ def addmodules(data):
|
|||||||
for key, module in data['lastStarport'].get('modules').items():
|
for key, module in data['lastStarport'].get('modules').items():
|
||||||
# sanity check
|
# sanity check
|
||||||
if int(key) != module.get('id'):
|
if int(key) != module.get('id'):
|
||||||
raise AssertionError('id: {} != {}'.format(key, module['id']))
|
raise ValueError('id: {} != {}'.format(key, module['id']))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
new = outfitting.lookup(module, companion.ship_map, True)
|
new = outfitting.lookup(module, companion.ship_map, True)
|
||||||
@ -106,7 +106,7 @@ def addmodules(data):
|
|||||||
size_pre -= 1
|
size_pre -= 1
|
||||||
|
|
||||||
elif str(new.get(thing, '')) != old.get(thing):
|
elif str(new.get(thing, '')) != old.get(thing):
|
||||||
raise AssertionError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
raise ValueError('{}: {} {!r}!={!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||||
|
|
||||||
modules[int(key)] = new
|
modules[int(key)] = new
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ def addships(data):
|
|||||||
size_pre -= 1
|
size_pre -= 1
|
||||||
|
|
||||||
elif str(new.get(thing, '')) != old.get(thing):
|
elif str(new.get(thing, '')) != old.get(thing):
|
||||||
raise AssertionError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
raise ValueError('{}: {} {!r} != {!r}'.format(key, thing, new.get(thing), old.get(thing)))
|
||||||
|
|
||||||
ships[int(key)] = new
|
ships[int(key)] = new
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user