Skip to content
This repository was archived by the owner on Jun 30, 2024. It is now read-only.

Commit 41b976f

Browse files
committed
Fix: make separate try/except blocks for insert
1 parent a5f5fd9 commit 41b976f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rsmanage/rsmanage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,15 +1148,18 @@ def addbookauthor(config, book, author, github):
11481148
values ( 'Temporary title for {book}', '{book}' )
11491149
"""
11501150
)
1151+
except Exception as e:
1152+
click.echo(f"Warning Book already exists in library {e}")
1153+
1154+
try:
11511155
res = engine.execute(
11521156
f"""insert into book_author
11531157
(author, book)
11541158
values ( '{author}', '{book}' )
11551159
"""
11561160
)
1157-
11581161
except Exception as e:
1159-
click.echo(f"Error setting book,author pair {e}")
1162+
click.echo(f"Warning setting book,author pair failed {e}")
11601163

11611164
# create an entry in auth_membership (group_id, user_id)
11621165
auth_row = engine.execute(

0 commit comments

Comments
 (0)