remove exception dumping to console

This commit is contained in:
scgbckbone 2025-05-13 16:12:06 +02:00 committed by doc-hex
parent 75a9f9f3eb
commit d4c4cc1b69
19 changed files with 33 additions and 44 deletions

View File

@ -833,7 +833,7 @@ async def start_login_sequence():
# safe to do so. Remember the bootrom checks PIN on every access to
# the secret, so "letting" them past this point is harmless if they don't know
# the true pin.
sys.print_exception(exc)
# sys.print_exception(exc)
if not pa.is_successful():
raise
@ -854,9 +854,7 @@ async def start_login_sequence():
try:
from pwsave import MicroSD2FA
MicroSD2FA.enforce_policy()
except BaseException as exc:
# robustness: keep going!
sys.print_exception(exc)
except: pass # robustness: keep going!
# implement idle timeout now that we are logged-in
IMPT.start_task('idle', idle_logout())

View File

@ -1148,7 +1148,7 @@ class NewPassphrase(UserAuthorizedAction):
except BaseException as exc:
self.failed = "Exception"
sys.print_exception(exc)
# sys.print_exception(exc)
finally:
self.done()
@ -1345,7 +1345,7 @@ class NewEnrollRequest(UserAuthorizedAction):
return await self.failure('No space left')
except BaseException as exc:
self.failed = "Exception"
sys.print_exception(exc)
# sys.print_exception(exc)
finally:
UserAuthorizedAction.cleanup() # because no results to store
self.pop_menu()
@ -1454,7 +1454,7 @@ Binary checksum and signature will be further verified before any changes are ma
except BaseException as exc:
self.failed = "Exception"
sys.print_exception(exc)
# sys.print_exception(exc)
finally:
UserAuthorizedAction.cleanup() # because no results to store
self.pop_menu()

View File

@ -146,9 +146,10 @@ def extract_long_secret(vals):
if ('long_secret' in vals) and version.has_608:
try:
ls = a2b_hex(vals.pop('long_secret'))
except Exception as exc:
sys.print_exception(exc)
except:
# sys.print_exception(exc)
# but keep going.
pass
return ls
def restore_from_dict_ll(vals):
@ -186,9 +187,7 @@ def restore_from_dict_ll(vals):
if ls is not None:
try:
pa.ls_change(ls)
except Exception as exc:
sys.print_exception(exc)
# but keep going
except: pass # but keep going
pb = .70
dis.progress_bar_show(pb)
@ -222,8 +221,7 @@ def restore_from_dict_ll(vals):
from trick_pins import tp
try:
tp.restore_backup(vals[key])
except Exception as exc:
sys.print_exception(exc)
except: pass
# continue as `tp.restore_backup` handles
# saving into settings

View File

@ -214,7 +214,7 @@ class BBQrState:
# can happen if QR got corrupted between scanner and us (overlap)
# or back BBQr implementation
#print("corrupt QR: %s" % scan)
import sys; sys.print_exception(exc)
# import sys; sys.print_exception(exc)
dis.draw_bbqr_progress(hdr, self.parts, corrupt=True)
return True

View File

@ -71,9 +71,9 @@ def restore_backup(s):
with open(POLICY_FNAME, 'wt') as f:
f.write(s)
except BaseException as exc:
except:
# keep going, we don't want to brick
sys.print_exception(exc)
# sys.print_exception(exc)
pass
def pop_list(j, fld_name, cleanup_fcn=None):
@ -936,7 +936,7 @@ class HSMPolicy:
return 'y'
except BaseException as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
err = "Rejected: " + (str(exc) or problem_file_line(exc))
self.refuse(log, err)

View File

@ -67,7 +67,7 @@ Press %s to save policy and enable HSM mode.''' % (self.policy.hash(), confirm_c
except BaseException as exc:
self.failed = "Exception"
sys.print_exception(exc)
# sys.print_exception(exc)
self.refused = True
self.ux_done = True
@ -354,7 +354,7 @@ class hsmUxInteraction:
await sleep_ms(100)
except BaseException as exc:
# just in case, keep going
sys.print_exception(exc)
# sys.print_exception(exc)
continue
# do the interactions, but don't let user actually press anything

View File

@ -58,7 +58,7 @@ class ImportantTask:
else:
# uncaught exception in an unnamed (and unimportant) task
print("UNNAMED: " + context["message"])
sys.print_exception(context["exception"])
# sys.print_exception(context["exception"])
print("... future: %r" % context.get("future", '?'))
def start_task(self, name, awaitable):

View File

@ -61,9 +61,7 @@ try:
from psram import PSRAMWrapper
glob.PSRAM = PSRAMWrapper()
except BaseException as exc:
sys.print_exception(exc)
# continue tho
except: pass # continue tho
# Setup keypad/keyboard
if version.has_qwerty:

View File

@ -57,8 +57,7 @@ def init0():
try:
make_psram_fs()
except BaseException as exc:
sys.print_exception(exc)
except: pass
if version.is_devmode:
try:

View File

@ -493,7 +493,7 @@ async def sd_sign_msg_done(signature, address, text, base=None, orig_path=None,
except OSError as exc:
prob = 'Failed to write!\n\n%s\n\n' % exc
sys.print_exception(exc)
# sys.print_exception(exc)
# fall through to try again
# prompt them to input another card?

View File

@ -1746,7 +1746,7 @@ async def ms_coordinator_file(af_str, my_xfp, chain, slot_b=None):
except Exception as exc:
# show something for coders, but no user feedback
sys.print_exception(exc)
# sys.print_exception(exc)
continue
except CardMissingError:

View File

@ -607,9 +607,7 @@ async def import_from_other(menu, *a):
obj = json.load(open(fname, 'rt'))
assert 'coldcard_notes' in obj
return True
except Exception as exc:
import sys; sys.print_exception(exc)
pass
except: pass
fn = await file_picker(min_size=8, max_size=100000, taster=contains_json, **choice)
if not fn: return

View File

@ -81,7 +81,7 @@ class AddressCacheFile:
except OSError:
return
except Exception as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
self.count = 0
self.hdr = None
return

View File

@ -859,7 +859,7 @@ class psbtInputProxy(psbtProxy):
try:
psbt.active_multisig.validate_script(redeem_script, subpaths=self.subpaths)
except BaseException as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
raise FatalPSBTIssue('Input #%d: %s' % (my_idx, exc))
if not which_key and DEBUG:

View File

@ -230,7 +230,7 @@ def disassemble(script):
#print('dis %d: opcode=%d' % (offset, c))
yield (None, c)
except Exception as e:
import sys;sys.print_exception(e)
# import sys;sys.print_exception(e)
raise ValueError("bad script")

View File

@ -374,8 +374,7 @@ class TrickPinMgmt:
b, slot = tp.update_slot(pin.encode(), new=True,
tc_flags=flags, tc_arg=arg, secret=new_secret)
except Exception as exc:
sys.print_exception(exc) # not visible
except: pass
tp = TrickPinMgmt()
@ -492,7 +491,7 @@ class TrickPinMenu(MenuSystem):
tc_arg=tc_arg, secret=new_secret)
await ux_dramatic_pause("Saved.", 1)
except BaseException as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
await ux_show_story("Failed: %s" % exc)
self.update_contents()
@ -712,7 +711,7 @@ You can restore it by trying to re-add the same PIN (%s) again later.''' % pin
self.pop_submenu() # too lazy to get redraw right
except BaseException as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
await ux_show_story("Failed: %s" % exc)
async def delete_pin(self, m,l, item):
@ -813,8 +812,7 @@ normal operation.''')
# save it
try:
b, slot = tp.update_slot(pin.encode(), tc_flags=flags, tc_arg=new_val)
except BaseException as exc:
sys.print_exception(exc)
except: pass
return va.index(cd_val), lgto_ch[1:], set_it

View File

@ -240,7 +240,7 @@ class USBHandler:
# catch bugs and fuzzing too
if is_simulator() or is_devmode:
print("USB request caused this: ", end='')
sys.print_exception(exc)
# sys.print_exception(exc)
resp = b'err_Confused ' + problem_file_line(exc)
if not success:

View File

@ -1059,7 +1059,7 @@ async def ux_visualize_txn(bin_txn):
msg += '\n\nTxid:\n' + b2a_hex(txid).decode()
except Exception as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
msg = "Unable to deserialize"
await ux_show_story(msg, title="Signed Transaction")

View File

@ -79,7 +79,7 @@ class VirtDisk:
# corrupt or unformated?
# XXX incomplete error handling here; needs work
VBLKDEV.set_inserted(True)
sys.print_exception(exc)
# sys.print_exception(exc)
return None
@ -93,7 +93,7 @@ class VirtDisk:
return list(sorted(('/vdisk/'+fn, sz) for (fn,ty,_,sz) in os.ilistdir('/vdisk')
if ty == 0x8000))
except BaseException as exc:
sys.print_exception(exc)
# sys.print_exception(exc)
return []
finally: