Skip to content

Commit 13f57eb

Browse files
committed
improved sqlite error message, added filename variable to output. looks nice
1 parent 138c0f8 commit 13f57eb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pastebin-mirror/storage.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ def save_paste_reference(self, table, key, timestamp, size, expires, title, synt
5353
class SQLite3Storage:
5454
def __init__(self, location='pastebin.db'):
5555
self.connection = sqlite3.connect(location)
56+
self.filename = location
5657

5758
def initialize_tables(self, trending=False):
58-
59+
# we only need to error check once when accessing the file for the first time
5960
try:
6061
self.connection.execute(
6162
'''
@@ -71,7 +72,7 @@ def initialize_tables(self, trending=False):
7172
'''
7273
)
7374
except sqlite3.OperationalError as e:
74-
print("[!] Error accessing database file: {}".format(e))
75+
print("[!] Error accessing database file {}: {}".format(self.filename, e))
7576
print("[!] Fatal Error: Exiting...")
7677
exit(1)
7778

0 commit comments

Comments
 (0)