threads / patch / 35180

patchCatch more exceptions in compat_log_entry()

Subject: [PATCH] Catch more exceptions in compat_log_entry()

## tl;dr

2 messages between Oct 22, 2013 and Nov 6, 2013. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Pavel Roskin· Oct 22, 2013, 14:31 UTC · lore

Catch exceptions in default_repo(). Catch git.RepositoryException. This suppresses stack trace in "stg pull" on detached head and outside the repository.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---
 stgit/lib/log.py |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to stgit/lib/log.py +2 −2
diff --git a/stgit/lib/log.py b/stgit/lib/log.py
index dfadd51..d876ff6 100644
--- a/stgit/lib/log.py
+++ b/stgit/lib/log.py
@@ -359,10 +359,10 @@ class Fakestack(object):
 def compat_log_entry(msg):
     """Write a new log entry. (Convenience function intended for use by
     code not yet converted to the new infrastructure.)"""
-    repo = default_repo()
     try:
+        repo = default_repo()
         stack = repo.get_stack(repo.current_branch_name)
-    except libstack.StackException, e:
+    except (libstack.StackException, git.RepositoryException), e:
         out.warn(str(e), 'Could not write to stack log')
     else:
         if repo.default_index.conflicts() and stack.patchorder.applied:
Catalin Marinas· Nov 6, 2013, 10:27 UTC · re: Pavel Roskin · lore

Re: [PATCH] Catch more exceptions in compat_log_entry()

On 22 October 2013 15:31, Pavel Roskin <proski@gnu.org> wrote:
Show 5 quoted lines
> Catch exceptions in default_repo().  Catch git.RepositoryException.
> This suppresses stack trace in "stg pull" on detached head and outside
> the repository.
>
> Signed-off-by: Pavel Roskin <proski@gnu.org>
Thanks. Applied.
Catalin

← back to recent threads