The Labs \ Source Viewer \ SSCLI \ System \ ApplicationException

  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: ApplicationException
  18. **
  19. **
  20. ** Purpose: The base class for all "less serious" exceptions that must be
  21. **          declared or caught.
  22. **
  23. **
  24. =============================================================================*/
  25. namespace System
  26. {
  27.    
  28.     using System.Runtime.Serialization;
  29.     // The ApplicationException is the base class for nonfatal,
  30.     // application errors that occur. These exceptions are generated
  31.     // (i.e., thrown) by an application, not the Runtime. Applications that need
  32.     // to create their own exceptions do so by extending this class.
  33.     // ApplicationException extends but adds no new functionality to
  34.     // RecoverableException.
  35.     //
  36.     [System.Runtime.InteropServices.ComVisible(true)]
  37.     [Serializable()]
  38.     public class ApplicationException : Exception
  39.     {
  40.        
  41.         // Creates a new ApplicationException with its message string set to
  42.         // the empty string, its HRESULT set to COR_E_APPLICATION,
  43.         // and its ExceptionInfo reference set to null.
  44.         public ApplicationException() : base(Environment.GetResourceString("Arg_ApplicationException"))
  45.         {
  46.             SetErrorCode(__HResults.COR_E_APPLICATION);
  47.         }
  48.        
  49.         // Creates a new ApplicationException with its message string set to
  50.         // message, its HRESULT set to COR_E_APPLICATION,
  51.         // and its ExceptionInfo reference set to null.
  52.         //
  53.         public ApplicationException(string message) : base(message)
  54.         {
  55.             SetErrorCode(__HResults.COR_E_APPLICATION);
  56.         }
  57.        
  58.         public ApplicationException(string message, Exception innerException) : base(message, innerException)
  59.         {
  60.             SetErrorCode(__HResults.COR_E_APPLICATION);
  61.         }
  62.        
  63.         protected ApplicationException(SerializationInfo info, StreamingContext context) : base(info, context)
  64.         {
  65.         }
  66.        
  67.     }
  68.    
  69. }

Developer Fusion