Raise a meaningful exception.
This commit is contained in:
+7
-1
@@ -21,6 +21,9 @@ import pisi.index
|
||||
import pisi.context as ctx
|
||||
import pisi.db.lazydb as lazydb
|
||||
|
||||
class RepoError(pisi.Error):
|
||||
pass
|
||||
|
||||
class Repo:
|
||||
def __init__(self, indexuri):
|
||||
self.indexuri = indexuri
|
||||
@@ -109,7 +112,10 @@ class RepoDB(lazydb.LazyDB):
|
||||
if index_path.endswith("bz2"):
|
||||
index_path = index_path.split(".bz2")[0]
|
||||
|
||||
return piksemel.parse(index_path)
|
||||
try:
|
||||
return piksemel.parse(index_path)
|
||||
except Exception, e:
|
||||
raise RepoError("Error parsing repository index information. Index file does not exist or is malformed.")
|
||||
|
||||
def get_repo(self, repo):
|
||||
return Repo(pisi.uri.URI(self.get_repo_url(repo)))
|
||||
|
||||
Reference in New Issue
Block a user