3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
7 using System
.Data
.Common
;
8 using System
.Data
.SqlClient
;
9 using System
.Runtime
.Serialization
;
11 class VxRequestException
: Exception
{
12 public string DBusErrorType
;
14 public VxRequestException(string errortype
)
17 DBusErrorType
= errortype
;
20 public VxRequestException(string errortype
, string msg
)
23 DBusErrorType
= errortype
;
26 public VxRequestException(string errortype
, SerializationInfo si
,
30 DBusErrorType
= errortype
;
33 public VxRequestException(string errortype
, string msg
, Exception inner
)
36 DBusErrorType
= errortype
;
40 class VxSqlException
: VxRequestException
{
41 public VxSqlException()
42 : base("vx.db.sqlerror")
46 public VxSqlException(string msg
)
47 : base("vx.db.sqlerror", msg
)
51 public VxSqlException(SerializationInfo si
, StreamingContext sc
)
52 : base("vx.db.sqlerror", si
, sc
)
56 public VxSqlException(string msg
, Exception inner
)
57 : base("vx.db.sqlerror", msg
, inner
)
61 public bool ContainsSqlError(int errno
)
63 if (!(InnerException
is SqlException
))
66 SqlException sqle
= (SqlException
)InnerException
;
67 foreach (SqlError err
in sqle
.Errors
)
69 if (err
.Number
== errno
)
75 // Returns the SQL error number of the first SQL Exception in the list, or
76 // -1 if none can be found.
81 if (!(InnerException
is SqlException
))
84 SqlException sqle
= (SqlException
)InnerException
;
90 class VxTooMuchDataException
: VxRequestException
{
91 public VxTooMuchDataException()
92 : base("vx.db.toomuchdata")
96 public VxTooMuchDataException(string msg
)
97 : base("vx.db.toomuchdata", msg
)
101 public VxTooMuchDataException(SerializationInfo si
, StreamingContext sc
)
102 : base("vx.db.toomuchdata", si
, sc
)
106 public VxTooMuchDataException(string msg
, Exception inner
)
107 : base("vx.db.toomuchdata", msg
, inner
)
112 class VxBadSchemaException
: VxRequestException
{
113 public VxBadSchemaException()
114 : base("vx.db.badschema")
118 public VxBadSchemaException(string msg
)
119 : base("vx.db.badschema", msg
)
123 public VxBadSchemaException(SerializationInfo si
, StreamingContext sc
)
124 : base("vx.db.badschema", si
, sc
)
128 public VxBadSchemaException(string msg
, Exception inner
)
129 : base("vx.db.badschema", msg
, inner
)
134 class VxConfigException
: VxRequestException
{
135 public VxConfigException()
136 : base("vx.db.configerror")
140 public VxConfigException(string msg
)
141 : base("vx.db.configerror", msg
)
145 public VxConfigException(SerializationInfo si
, StreamingContext sc
)
146 : base("vx.db.configerror", si
, sc
)
150 public VxConfigException(string msg
, Exception inner
)
151 : base("vx.db.configerror", msg
, inner
)
156 class VxSecurityException
: VxRequestException
{
157 public VxSecurityException()
158 : base("vx.db.securityerror")
162 public VxSecurityException(string msg
)
163 : base("vx.db.securityerror", msg
)