aboutsummaryrefslogtreecommitdiffstats
path: root/MgaRepo/commands/maintdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'MgaRepo/commands/maintdb.py')
-rw-r--r--MgaRepo/commands/maintdb.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/MgaRepo/commands/maintdb.py b/MgaRepo/commands/maintdb.py
index 83621b1..ad830b4 100644
--- a/MgaRepo/commands/maintdb.py
+++ b/MgaRepo/commands/maintdb.py
@@ -34,8 +34,16 @@ def maintdb(maintdb_args):
host = config.get("maintdb", "host", "maintdb.mageia.org")
if (maintdb_args[0] == 'get' and len(maintdb_args)>=2):
import urllib.request
- page=urllib.request.urlopen('http://'+host+'/'+maintdb_args[1])
- rep = page.read().decode('utf8')
+ try:
+ page=urllib.request.urlopen('http://'+host+'/'+maintdb_args[1])
+ rep = page.read().decode('utf8')
+ except urllib.error.HTTPError as e:
+ if e.code == 404 :
+ rep = "There is no package named {}".format(maintdb_args[1])
+ else:
+ rep = e.reason
+ except Exception as e:
+ rep = "Error trying to query the database : {}. Have you active Internet connection?".format(e.reason)
print(rep)
else:
maintdb_helper = get_helper("maintdb")