The Labs \ Source Viewer \ SSCLI \ System.Runtime.InteropServices \ ExternalException

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*=============================================================================
  16. **
  17. ** Class: ExternalException
  18. **
  19. **
  20. ** Purpose: Exception base class for all errors from Interop or Structured
  21. **          Exception Handling code.
  22. **
  23. **
  24. =============================================================================*/
  25. namespace System.Runtime.InteropServices
  26. {
  27.    
  28.     using System;
  29.     using System.Runtime.Serialization;
  30.     // Base exception for COM Interop errors &; Structured Exception Handler
  31.     // exceptions.
  32.     //
  33.     [System.Runtime.InteropServices.ComVisible(true)]
  34.     [Serializable()]
  35.     public class ExternalException : SystemException
  36.     {
  37.         public ExternalException() : base(Environment.GetResourceString("Arg_ExternalException"))
  38.         {
  39.             SetErrorCode(__HResults.E_FAIL);
  40.         }
  41.        
  42.         public ExternalException(string message) : base(message)
  43.         {
  44.             SetErrorCode(__HResults.E_FAIL);
  45.         }
  46.        
  47.         public ExternalException(string message, Exception inner) : base(message, inner)
  48.         {
  49.             SetErrorCode(__HResults.E_FAIL);
  50.         }
  51.        
  52.         public ExternalException(string message, int errorCode) : base(message)
  53.         {
  54.             SetErrorCode(errorCode);
  55.         }
  56.        
  57.         protected ExternalException(SerializationInfo info, StreamingContext context) : base(info, context)
  58.         {
  59.         }
  60.        
  61.         public virtual int ErrorCode {
  62.             get { return HResult; }
  63.         }
  64.     }
  65. }

Developer Fusion