txErrorObserver.h 978 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef MITRE_ERROROBSERVER_H
  6. #define MITRE_ERROROBSERVER_H
  7. #include "txCore.h"
  8. /**
  9. * A simple interface for observing errors
  10. **/
  11. class ErrorObserver {
  12. public:
  13. /**
  14. * Default Destructor for ErrorObserver
  15. **/
  16. virtual ~ErrorObserver() {};
  17. /**
  18. * Notifies this Error observer of a new error aRes
  19. **/
  20. virtual void receiveError(const nsAString& errorMessage, nsresult aRes) = 0;
  21. /**
  22. * Notifies this Error observer of a new error, with default
  23. * error code NS_ERROR_FAILURE
  24. **/
  25. void receiveError(const nsAString& errorMessage)
  26. {
  27. receiveError(errorMessage, NS_ERROR_FAILURE);
  28. }
  29. }; //-- ErrorObserver
  30. #endif