From 8185ac21732bcc784b678da5954ab3cf16078fa8 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 25 Apr 2012 16:00:52 +0100 Subject: Add morphlib.Error and make local repo cache exceptions be based on it This way, cliapp will automatically print an error message, rather than a stack trace. --- morphlib/localrepocache.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'morphlib/localrepocache.py') diff --git a/morphlib/localrepocache.py b/morphlib/localrepocache.py index 5e04b187..b8dfea88 100644 --- a/morphlib/localrepocache.py +++ b/morphlib/localrepocache.py @@ -34,7 +34,7 @@ urlparse.uses_fragment.extend(gitscheme) -class NoRemote(Exception): +class NoRemote(morphlib.Error): def __init__(self, reponame, errors): self.reponame = reponame @@ -44,13 +44,14 @@ class NoRemote(Exception): return '\n\t'.join(['Cannot find remote git repository: %s' % self.reponame] + self.errors) -class NotCached(Exception): +class NotCached(morphlib.Error): def __init__(self, reponame): self.reponame = reponame def __str__(self): # pragma: no cover return 'Repository %s is not cached yet' % self.reponame + class LocalRepoCache(object): '''Manage locally cached git repositories. -- cgit v1.2.1