~ellisonbg/ipython/trunk-dev

« back to all changes in this revision

Viewing changes to IPython/core/error.py

  • Committer: Brian Granger
  • Date: 2010-01-31 23:57:46 UTC
  • mfrom: (1109.1.113 ipython)
  • Revision ID: ellisonbg@gmail.com-20100131235746-rj81qa8klooepq2m
Merging from upstream trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# encoding: utf-8
 
3
"""
 
4
Global exception classes for IPython.core.
 
5
 
 
6
Authors:
 
7
 
 
8
* Brian Granger
 
9
* Fernando Perez
 
10
 
 
11
Notes
 
12
-----
 
13
"""
 
14
 
 
15
#-----------------------------------------------------------------------------
 
16
#  Copyright (C) 2008-2009  The IPython Development Team
 
17
#
 
18
#  Distributed under the terms of the BSD License.  The full license is in
 
19
#  the file COPYING, distributed as part of this software.
 
20
#-----------------------------------------------------------------------------
 
21
 
 
22
#-----------------------------------------------------------------------------
 
23
# Imports
 
24
#-----------------------------------------------------------------------------
 
25
 
 
26
#-----------------------------------------------------------------------------
 
27
# Exception classes
 
28
#-----------------------------------------------------------------------------
 
29
 
 
30
class IPythonCoreError(Exception):
 
31
    pass
 
32
 
 
33
 
 
34
class TryNext(IPythonCoreError):
 
35
    """Try next hook exception.
 
36
     
 
37
    Raise this in your hook function to indicate that the next hook handler
 
38
    should be used to handle the operation.  If you pass arguments to the
 
39
    constructor those arguments will be used by the next hook instead of the
 
40
    original ones.
 
41
    """
 
42
 
 
43
    def __init__(self, *args, **kwargs):
 
44
        self.args = args
 
45
        self.kwargs = kwargs
 
46
 
 
47
class UsageError(IPythonCoreError):
 
48
    """Error in magic function arguments, etc.
 
49
    
 
50
    Something that probably won't warrant a full traceback, but should
 
51
    nevertheless interrupt a macro / batch file.   
 
52
    """
 
 
b'\\ No newline at end of file'