Allow schema files that are missing checksums on the !!SCHEMAMATIC line.
[versaplex.git] / versaplexd / vxexceptions.cs
blob2a3e8a9cd8844704cf5bc31f56d428231e2c6a7a
1 /*
2 * Versaplex:
3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
5 */
6 using System;
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)
15 : base()
17 DBusErrorType = errortype;
20 public VxRequestException(string errortype, string msg)
21 : base(msg)
23 DBusErrorType = errortype;
26 public VxRequestException(string errortype, SerializationInfo si,
27 StreamingContext sc)
28 : base(si, sc)
30 DBusErrorType = errortype;
33 public VxRequestException(string errortype, string msg, Exception inner)
34 : base(msg, 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))
64 return false;
66 SqlException sqle = (SqlException)InnerException;
67 foreach (SqlError err in sqle.Errors)
69 if (err.Number == errno)
70 return true;
72 return false;
75 // Returns the SQL error number of the first SQL Exception in the list, or
76 // -1 if none can be found.
77 public int Number
79 get
81 if (!(InnerException is SqlException))
82 return -1;
84 SqlException sqle = (SqlException)InnerException;
85 return sqle.Number;
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)