2 * Firebird ADO.NET Data provider for .NET and Mono
\r
4 * The contents of this file are subject to the Initial
\r
5 * Developer's Public License Version 1.0 (the "License");
\r
6 * you may not use this file except in compliance with the
\r
7 * License. You may obtain a copy of the License at
\r
8 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
\r
10 * Software distributed under the License is distributed on
\r
11 * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
\r
12 * express or implied. See the License for the specific
\r
13 * language governing rights and limitations under the License.
\r
15 * Copyright (c) 2002, 2005 Carlos Guzman Alvarez
\r
16 * All Rights Reserved.
\r
20 using System.ComponentModel;
\r
21 using System.Security.Permissions;
\r
22 using FirebirdSql.Data.Common;
\r
24 namespace FirebirdSql.Data.Firebird
\r
26 /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/overview/*'/>
\r
30 public sealed class FbException : SystemException
\r
34 private FbErrorCollection errors = new FbErrorCollection();
\r
35 private int errorCode;
\r
41 /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="Errors"]/*'/>
\r
43 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
\r
45 public FbErrorCollection Errors
\r
47 get { return this.errors; }
\r
50 /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/property[@name="ErrorCode"]/*'/>
\r
51 public int ErrorCode
\r
53 get { return this.errorCode; }
\r
58 #region Constructors
\r
60 internal FbException() : base()
\r
64 internal FbException(string message) : base(message)
\r
68 internal FbException(string message, IscException ex) : base(message)
\r
70 this.errorCode = ex.ErrorCode;
\r
72 this.Source = ex.Source;
\r
75 this.GetIscExceptionErrors(ex);
\r
80 internal FbException(
\r
81 System.Runtime.Serialization.SerializationInfo info,
\r
82 System.Runtime.Serialization.StreamingContext context) : base(info, context)
\r
84 this.errors = (FbErrorCollection)info.GetValue("errors", typeof(FbErrorCollection));
\r
85 this.errorCode = info.GetInt32("errorCode");
\r
96 /// <include file='Doc/en_EN/FbException.xml' path='doc/class[@name="FbException"]/method[@name="GetObjectData(SerializationInfo, StreamingContext)"]/*'/>
\r
97 [SecurityPermissionAttribute(SecurityAction.Demand, SerializationFormatter = true)]
\r
98 public override void GetObjectData(
\r
99 System.Runtime.Serialization.SerializationInfo info,
\r
100 System.Runtime.Serialization.StreamingContext context)
\r
102 info.AddValue("errors", this.errors);
\r
103 info.AddValue("errorCode", this.errorCode);
\r
105 base.GetObjectData(info, context);
\r
112 #region Internal Methods
\r
114 internal void GetIscExceptionErrors(IscException ex)
\r
116 foreach (IscError error in ex.Errors)
\r
118 this.errors.Add(error.Message, error.ErrorCode);
\r