Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
4a9b01e9
Commit
4a9b01e9
authored
Jan 10, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added IntegrityError to catched error
parent
b7de23e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
editbooks.py
cps/editbooks.py
+3
-3
web.py
cps/web.py
+1
-1
No files found.
cps/editbooks.py
View file @
4a9b01e9
...
...
@@ -30,7 +30,7 @@ from uuid import uuid4
from
flask
import
Blueprint
,
request
,
flash
,
redirect
,
url_for
,
abort
,
Markup
,
Response
from
flask_babel
import
gettext
as
_
from
flask_login
import
current_user
,
login_required
from
sqlalchemy.exc
import
OperationalError
from
sqlalchemy.exc
import
OperationalError
,
IntegrityError
from
.
import
constants
,
logger
,
isoLanguages
,
gdriveutils
,
uploader
,
helper
from
.
import
config
,
get_locale
,
ub
,
db
...
...
@@ -570,7 +570,7 @@ def upload_single_file(request, book, book_id):
calibre_db
.
session
.
add
(
db_format
)
calibre_db
.
session
.
commit
()
calibre_db
.
update_title_sort
(
config
)
except
OperationalError
as
e
:
except
(
OperationalError
,
IntegrityError
)
as
e
:
calibre_db
.
session
.
rollback
()
log
.
error
(
'Database error:
%
s'
,
e
)
flash
(
_
(
u"Database error:
%(error)
s."
,
error
=
e
),
category
=
"error"
)
...
...
@@ -925,7 +925,7 @@ def upload():
else
:
resp
=
{
"location"
:
url_for
(
'web.show_book'
,
book_id
=
book_id
)}
return
Response
(
json
.
dumps
(
resp
),
mimetype
=
'application/json'
)
except
OperationalError
as
e
:
except
(
OperationalError
,
IntegrityError
)
as
e
:
calibre_db
.
session
.
rollback
()
log
.
error
(
"Database error:
%
s"
,
e
)
flash
(
_
(
u"Database error:
%(error)
s."
,
error
=
e
),
category
=
"error"
)
...
...
cps/web.py
View file @
4a9b01e9
...
...
@@ -184,7 +184,7 @@ def toggle_read(book_id):
calibre_db
.
session
.
commit
()
except
(
KeyError
,
AttributeError
):
log
.
error
(
u"Custom Column No.
%
d is not exisiting in calibre database"
,
config
.
config_read_column
)
except
OperationalError
as
e
:
except
(
OperationalError
,
OperationalError
)
as
e
:
calibre_db
.
session
.
rollback
()
log
.
error
(
u"Read status could not set:
%
e"
,
e
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment