[annuaires_pg] Messages d'erreur plus verbeux
This commit is contained in:
parent
e37c04cdd4
commit
dba7ad88e6
1 changed files with 5 additions and 5 deletions
|
@ -35,7 +35,7 @@ def chbre_prises(batiment, chambre = None):
|
|||
try:
|
||||
return "%03d" % cur.fetchone()[0]
|
||||
except TypeError:
|
||||
raise ValueError("Chambre inexistante")
|
||||
raise ValueError("Chambre inexistante bat %r, chbre %r" % (batiment, chambre))
|
||||
else:
|
||||
cur = conn.cursor()
|
||||
cur.execute("SELECT chambre, prise_crans FROM prises WHERE batiment = %s", batiment)
|
||||
|
@ -43,7 +43,7 @@ def chbre_prises(batiment, chambre = None):
|
|||
for chambre, prise_crans in cur.fetchall():
|
||||
ret[chambre] = "%03d" % prise_crans
|
||||
if not ret:
|
||||
raise ValueError("Batiment inexistant")
|
||||
raise ValueError("Batiment %s inexistant" % batiment)
|
||||
return ret
|
||||
|
||||
@_need_conn
|
||||
|
@ -56,7 +56,7 @@ def chbre_commentaire(batiment, chambre):
|
|||
try:
|
||||
return cur.fetchone()[0]
|
||||
except TypeError:
|
||||
raise ValueError("Chambre inexistante")
|
||||
raise ValueError("Chambre inexistante bat %r, chbre %r" % (batiment, chambre))
|
||||
|
||||
@_need_conn
|
||||
def reverse(batiment, prise = None):
|
||||
|
@ -68,7 +68,7 @@ def reverse(batiment, prise = None):
|
|||
try:
|
||||
return [chbre for (chbre,) in cur.fetchall()]
|
||||
except TypeError:
|
||||
raise ValueError("Prise inexistante")
|
||||
raise ValueError("Prise %s inexistante" % prise)
|
||||
else:
|
||||
cur = conn.cursor()
|
||||
cur.execute("SELECT chambre, prise_crans FROM prises WHERE batiment = %s", batiment)
|
||||
|
@ -80,7 +80,7 @@ def reverse(batiment, prise = None):
|
|||
ret["%03d" % prise_crans] = [chambre]
|
||||
|
||||
if not ret:
|
||||
raise ValueError("Batiment inexistant")
|
||||
raise ValueError("Batiment %s inexistant" % batiment)
|
||||
return ret
|
||||
|
||||
@_need_conn
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue