aboutsummaryrefslogtreecommitdiff
path: root/app/views.py
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2020-09-24 16:57:10 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2020-09-24 16:57:10 +0530
commit0ff2f3189ea5aea74303138b531994026222d524 (patch)
treef68b69293c3a03cbf364874c93e76f0166003455 /app/views.py
parenta3e3511e3b6a7419ce5aed5847e481595971b7bc (diff)
added exception handling for unknown hostname
Diffstat (limited to 'app/views.py')
-rw-r--r--app/views.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/views.py b/app/views.py
index 5b105ed..47a37ac 100644
--- a/app/views.py
+++ b/app/views.py
@@ -15,7 +15,7 @@ import json
import subprocess
import mysql.connector as con
-from mysql.connector.errors import InterfaceError
+from mysql.connector.errors import InterfaceError,DatabaseError
import requests
@@ -134,6 +134,8 @@ def status():
mycursor = mycon.cursor()
except InterfaceError:
return render_template('error.html',code="DB00",description=errors['DB00'])
+ except DatabaseError:
+ return render_template('error.html',code="DB02",description=errors['DB02'])
sqlQuery = 'select id, protein_name, ligand_name, date, description, done, pdb from curieweb where id="%s"' % (jobID)
mycursor.execute(sqlQuery)
records = mycursor.fetchall()
@@ -309,6 +311,8 @@ def dock_manual():
mycursor = mycon.cursor()
except InterfaceError:
return render_template("error.html",code="DB00",description=errors['DB00'])
+ except DatabaseError:
+ return render_template("error.html",code="DB02",description=errors['DB02'])
import tempfile
with tempfile.TemporaryDirectory() as directory:
@@ -361,6 +365,8 @@ def dock_automatic():
mycursor = mycon.cursor()
except InterfaceError:
return render_template('error.html',code="DB00",description=errors['DB00'])
+ except DatabaseError:
+ return render_template("error.html",code="DB02",description=errors['DB02'])
sqlQuery = "insert into curieweb (id, email, pdb, ligand_smile, ligand_name, date, description) values (%s,%s,%s,%s,%s,CURDATE(),%s) "
jobID = gen_word(16, 1, 1)