Package mysql :: Package exceptions
[hide private]
[frames] | no frames]

Source Code for Package mysql.exceptions

 1  # $Header: /home/cvs2/mysql/mysql/exceptions/__init__.py,v 1.3 2006/08/26 20:19:52 ehuss Exp $ 
 2  # Copyright (c) 2006, Eric Huss 
 3  # All rights reserved. 
 4  # 
 5  # Redistribution and use in source and binary forms, with or without 
 6  # modification, are permitted provided that the following conditions are met: 
 7  # 
 8  # 1. Redistributions of source code must retain the above copyright notice, 
 9  #    this list of conditions and the following disclaimer. 
10  # 2. Redistributions in binary form must reproduce the above copyright notice, 
11  #    this list of conditions and the following disclaimer in the documentation 
12  #    and/or other materials provided with the distribution. 
13  # 3. Neither the name of Eric Huss nor the names of any contributors may be 
14  #    used to endorse or promote products derived from this software without 
15  #    specific prior written permission. 
16  # 
17  # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
18  # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
19  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
20  # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
21  # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
22  # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
23  # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
24  # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
25  # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
26  # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
27  # POSSIBILITY OF SUCH DAMAGE. 
28   
29  """All MySQL exceptions. 
30   
31  This package contains all exceptions for the MySQL library.  All exceptions 
32  from the submodules are imported into the top-level of this package so you do 
33  not need to import any of the specific submodules. 
34   
35  There is a base exception `Error` for all exceptions. 
36   
37  There is generally two types of exceptions.  The ones that derive from 
38  `MySQL_Error` are the ones that have a MySQL error code and are probably 
39  generated by MySQL itself.  The others do not derive from `MySQL_Error` and are 
40  generated by this Python library (these can be found in the 
41  `mysql.exceptions.internal` module). 
42   
43  All errors that MySQL can generate have been given their own exception object. 
44  These are generally the error code from the C library converted to bumpy case 
45  with a few underscores added here and there to make them slightly more 
46  readable. 
47   
48  Note that the MySQL API is somewhat inconsistent in its naming convention. 
49  Sometimes the error code ends with ``_ERROR`` and sometimes it doesn't. 
50  Although I'm tempted to normalize the naming scheme, I figure it might make 
51  issues more confusing. 
52   
53  A modest attempt has been made to include the potential exceptions that might 
54  be risen by various methods throughout this Python library in the docstrings. 
55  This is mainly based on the MySQL documentation.  However, it is very far from 
56  complete. Particularly, errors that are risen from the server side (those found 
57  in `mysql.exceptions.server`) are generally not addressed at all in the 
58  docstrings.  This would be a monumental task to try to identify them all and 
59  properly document them.  It also might create too much noise, because many of 
60  the server-side errors are not ones you would normally bother to catch. 
61  """ 
62   
63  __version__ = '$Revision: 1.3 $' 
64   
65  from mysql.exceptions.base import * 
66  from mysql.exceptions.client import * 
67  from mysql.exceptions.internal import * 
68  from mysql.exceptions.server import * 
69  from mysql.exceptions.map import raise_error 
70