ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/gr2lib/trunk/gr2lib/core/exceptions/granny2apiloadexception.cs
Revision: 46
Committed: Thu Jul 15 07:29:23 2010 UTC (12 years, 8 months ago) by william
File size: 1761 byte(s)
Log Message:
Add exception for handling Granny2 API Load errors

File Contents

# User Rev Content
1 william 46 using System;
2     using System.Collections.Generic;
3     using System.Text;
4    
5     using System.Runtime.Serialization;
6    
7     namespace gr2lib.core.exceptions
8     {
9     #region Granny2 API Load Exceptions
10    
11     #region public class granny2apiloadexception
12     [Serializable()]
13     public class granny2apiloadexception : System.Exception, ISerializable
14     {
15     private const string error_message = "ERROR: Unable to load granny2 API";
16     public granny2apiloadexception() : this(new granny2dllnotfoundexception()) { }
17     private granny2apiloadexception(Exception inner) : base(error_message, inner) { }
18     protected granny2apiloadexception(SerializationInfo info, StreamingContext context) : base(info, context) { }
19    
20     public override string Message
21     {
22     get
23     {
24     return error_message + "\n" +
25     "REASON: " + this.InnerException.Message;
26     }
27     }
28    
29     #region public class granny2dllnotfoundexception
30     [Serializable()]
31     private class granny2dllnotfoundexception : System.Exception, ISerializable
32     {
33     public override string Message
34     {
35     get
36     {
37     return this.InnerException.Message + " was not found.";
38     }
39     }
40     public granny2dllnotfoundexception() : this(new System.IO.FileNotFoundException("granny2.dll")) { }
41     private granny2dllnotfoundexception(Exception inner) : base("", inner) { }
42     protected granny2dllnotfoundexception(SerializationInfo info, StreamingContext context) : base(info, context) { }
43     }
44     #endregion
45     }
46    
47     #endregion
48    
49    
50     #endregion
51     }
52