This makes it easier to catch them all. (Indeed, the very long list of
exceptions to catch in main.py was missing some of the exceptions.)
Signed-off-by: Karl Hasselström <kha@treskal.com>
import sys, os, os.path, re
from optparse import OptionParser, make_option
import sys, os, os.path, re
from optparse import OptionParser, make_option
+from stgit.exception import *
from stgit.utils import *
from stgit.out import *
from stgit import stack, git, basedir
from stgit.utils import *
from stgit.out import *
from stgit import stack, git, basedir
# Command exception class
# Command exception class
-class CmdException(Exception):
+class CmdException(StgException):
-class RevParseException(Exception):
+class RevParseException(StgException):
"""Revision spec parse error."""
pass
"""Revision spec parse error."""
pass
import os, re
from stgit import basedir
import os, re
from stgit import basedir
+from stgit.exception import *
-class GitConfigException(Exception):
+class GitConfigException(StgException):
--- /dev/null
+class StgException(Exception):
+ """Base class for all StGit exceptions."""
+ pass
import sys, os, re, gitmergeonefile
from shutil import copyfile
import sys, os, re, gitmergeonefile
from shutil import copyfile
+from stgit.exception import *
from stgit import basedir
from stgit.utils import *
from stgit.out import *
from stgit import basedir
from stgit.utils import *
from stgit.out import *
from stgit.config import config
# git exception class
from stgit.config import config
# git exception class
-class GitException(Exception):
+class GitException(StgException):
pass
# When a subprocess has a problem, we want the exception to be a
pass
# When a subprocess has a problem, we want the exception to be a
+from stgit.exception import *
from stgit import basedir
from stgit.config import config, file_extensions, ConfigOption
from stgit.utils import append_string
from stgit.out import *
from stgit.run import *
from stgit import basedir
from stgit.config import config, file_extensions, ConfigOption
from stgit.utils import append_string
from stgit.out import *
from stgit.run import *
-class GitMergeException(Exception):
+class GitMergeException(StgException):
# These modules are only used from this point onwards and do not
# need to be imported earlier
# These modules are only used from this point onwards and do not
# need to be imported earlier
+ from stgit.exception import StgException
from stgit.config import config_setup
from ConfigParser import ParsingError, NoSectionError
from stgit.config import config_setup
from ConfigParser import ParsingError, NoSectionError
- from stgit.stack import Series, StackException
- from stgit.git import GitException
- from stgit.commands.common import CmdException
- from stgit.gitmergeonefile import GitMergeException
- from stgit.utils import EditorException
+ from stgit.stack import Series
try:
debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
try:
debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
stgit.commands.common.crt_series = command.crt_series
command.func(parser, options, args)
stgit.commands.common.crt_series = command.crt_series
command.func(parser, options, args)
- except (IOError, ParsingError, NoSectionError, CmdException,
- StackException, GitException, GitMergeException,
- EditorException), err:
+ except (StgException, IOError, ParsingError, NoSectionError), err:
print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
if debug_level > 0:
raise
print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
if debug_level > 0:
raise
import datetime, os, subprocess
import datetime, os, subprocess
+from stgit.exception import *
+from stgit.out import *
-class RunException(Exception):
+class RunException(StgException):
"""Thrown when something bad happened when we tried to run the
subprocess."""
pass
"""Thrown when something bad happened when we tried to run the
subprocess."""
pass
import sys, os, re
from email.Utils import formatdate
import sys, os, re
from email.Utils import formatdate
+from stgit.exception import *
from stgit.utils import *
from stgit.out import *
from stgit.run import *
from stgit.utils import *
from stgit.out import *
from stgit.run import *
-class StackException(Exception):
+class StackException(StgException):
"""
import errno, optparse, os, os.path, re, sys
"""
import errno, optparse, os, os.path, re, sys
+from stgit.exception import *
from stgit.config import config
from stgit.out import *
from stgit.config import config
from stgit.out import *
# file1's parent dir may not be empty after move
pass
# file1's parent dir may not be empty after move
pass
-class EditorException(Exception):
+class EditorException(StgException):
pass
def call_editor(filename):
pass
def call_editor(filename):