diff options
| author | Steven Knight <knight@baldmt.com> | 2001-08-18 20:51:21 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2001-08-18 20:51:21 (GMT) |
| commit | 2bd067fd38e6d3a636c7d46a1273f2cdc72e653c (patch) | |
| tree | 73bc220e14dbf684e0b7b3efe4c52d5e734d4c39 /src/scons | |
| parent | 7884cffaf3380a66a999ae8db12e0418f96993c0 (diff) | |
| download | SCons-2bd067fd38e6d3a636c7d46a1273f2cdc72e653c.zip SCons-2bd067fd38e6d3a636c7d46a1273f2cdc72e653c.tar.gz SCons-2bd067fd38e6d3a636c7d46a1273f2cdc72e653c.tar.bz2 | |
Implement error framework.
Diffstat (limited to 'src/scons')
| -rw-r--r-- | src/scons/Errors.py | 18 | ||||
| -rw-r--r-- | src/scons/ErrorsTests.py | 28 |
2 files changed, 46 insertions, 0 deletions
diff --git a/src/scons/Errors.py b/src/scons/Errors.py new file mode 100644 index 0000000..2709c19 --- /dev/null +++ b/src/scons/Errors.py @@ -0,0 +1,18 @@ +"""scons.Errors + +This file contains the exception classes used to handle internal +and user errors in scons. + +""" + +__revision__ = "Errors.py __REVISION__ __DATE__ __DEVELOPER__" + + + +class InternalError(Exception): + def __init__(self, args=None): + self.args = args + +class UserError(Exception): + def __init__(self, args=None): + self.args = args diff --git a/src/scons/ErrorsTests.py b/src/scons/ErrorsTests.py new file mode 100644 index 0000000..8d27332 --- /dev/null +++ b/src/scons/ErrorsTests.py @@ -0,0 +1,28 @@ +__revision__ = "ErrorsTests.py __REVISION__ __DATE__ __DEVELOPER__" + +import sys +import unittest +from scons.Errors import InternalError, UserError + + +class ErrorsTestCase(unittest.TestCase): + def test_InternalError(self): + """Test the InternalError exception.""" + try: + raise InternalError, "test internal error" + except InternalError, e: + assert e.args == "test internal error" + + def test_UserError(self): + """Test the UserError exception.""" + try: + raise UserError, "test user error" + except UserError, e: + assert e.args == "test user error" + + + +if __name__ == "__main__": + suite = unittest.makeSuite(ErrorsTestCase, 'test_') + if not unittest.TextTestRunner().run(suite).wasSuccessful(): + sys.exit(1) |
