Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
2.0 KiB

  1. //***************************************************************************
  2. //
  3. // File:
  4. //
  5. // Module: MS SNMP Provider
  6. //
  7. // Purpose:
  8. //
  9. // Copyright (c) 1997-2001 Microsoft Corporation, All Rights Reserved
  10. //
  11. //***************************************************************************
  12. /*-----------------------------------------------------------------
  13. Filename: encap.hpp
  14. Written By: B.Rajeev
  15. Purpose: The GeneralException is thrown on encountering situations
  16. such as an errored call to the WinSNMP library and mutex/timer calls.
  17. It encapsulates the SnmpErrorReport since that is the vehicle for exchange
  18. of error information for SNMPCL objects
  19. -----------------------------------------------------------------*/
  20. #ifndef __EXCEPTION__
  21. #define __EXCEPTION__
  22. #include "error.h"
  23. // This exception is used to convey the error and status
  24. // for exception error situations to the calling methods
  25. class DllImportExport GeneralException: public SnmpErrorReport
  26. {
  27. private:
  28. int line ;
  29. char *file ;
  30. DWORD errorCode ;
  31. public:
  32. GeneralException(IN const SnmpError error, IN const SnmpStatus status, char *fileArg = NULL , int lineArg = 0 , DWORD errorCodeArg = 0 )
  33. : SnmpErrorReport(error, status) , line ( lineArg ) , errorCode ( errorCodeArg )
  34. {
  35. file = fileArg ? _strdup ( fileArg ) : NULL ;
  36. }
  37. GeneralException(IN const SnmpErrorReport &error_report,char *fileArg = NULL , int lineArg = 0 , DWORD errorCodeArg = 0 )
  38. : SnmpErrorReport(error_report) , line ( lineArg ) , errorCode ( errorCodeArg )
  39. {
  40. file = fileArg ? _strdup ( fileArg ) : NULL ;
  41. }
  42. GeneralException(IN const GeneralException &exception )
  43. : SnmpErrorReport(exception)
  44. {
  45. line = exception.line ;
  46. errorCode = exception.errorCode ;
  47. file = exception.file ? _strdup ( exception.file ) : NULL ;
  48. }
  49. ~GeneralException() { free ( file ) ; }
  50. int GetLine () { return line ; }
  51. char *GetFile () { return file ; }
  52. };
  53. #endif // __EXCEPTION__