Skip to content

Commit

Permalink
Error-handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thewhaleking committed Aug 27, 2024
1 parent 59281c6 commit 72f1590
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/commands/stake.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import copy
import json
import sqlite3
from contextlib import suppress
from math import floor
from typing import TYPE_CHECKING, Union, Optional, Sequence, cast
Expand Down Expand Up @@ -1159,8 +1160,17 @@ async def get_all_wallet_accounts(
}
update_metadata_table("stakeshow", metadata)
else:
metadata = get_metadata_table("stakeshow")
rows = json.loads(metadata["rows"])
try:
metadata = get_metadata_table("stakeshow")
rows = json.loads(metadata["rows"])
except sqlite3.OperationalError:
err_console.print(
"[red]Error[/red] Unable to retrieve table data. This is usually caused by attempting to use "
"`--reuse-last` before running the command a first time. In rare cases, this could also be due to "
"a corrupted database. Re-run the command (do not use `--reuse-last`) and see if that resolves your "
"issue."
)
return
if not html_output:
table = Table(
Column(
Expand Down

0 comments on commit 72f1590

Please sign in to comment.