Skip to content

Commit 5b5da1b

Browse files
committed
fix README example code not working due to missing import
1 parent 6bbc23f commit 5b5da1b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pip install prompt-toolkit
4343

4444
```python
4545
from jsondb import JsonDB
46+
from jsondb.exceptions import TableExistsError, Error
4647

4748
# Initialize the database
4849
db = JsonDB('my_database.json')
@@ -68,9 +69,9 @@ try:
6869
# Show final data
6970
db.show_data('users')
7071

71-
except db.TableExistsError as e:
72+
except TableExistsError as e:
7273
print(f"Setup failed because a table already exists: {e}")
73-
except db.Error as e: # Catch any library-specific error
74+
except Error as e: # Catch any library-specific error
7475
print(f"An error occurred with the database: {e}")
7576
except Exception as e:
7677
print(f"A general error occurred: {e}")

0 commit comments

Comments
 (0)