exception.h 962 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) Facebook, Inc. and its affiliates.
  2. // All rights reserved.
  3. //
  4. // This source code is licensed under the BSD-style license found in the
  5. // LICENSE file in the root directory of this source tree.
  6. #pragma once
  7. #include <stdexcept>
  8. #include <c10/macros/Macros.h>
  9. namespace c10d {
  10. class TORCH_API C10dError : public std::runtime_error {
  11. public:
  12. using std::runtime_error::runtime_error;
  13. C10dError(const C10dError&) = default;
  14. C10dError& operator=(const C10dError&) = default;
  15. C10dError(C10dError&&) = default;
  16. C10dError& operator=(C10dError&&) = default;
  17. ~C10dError() override;
  18. };
  19. class TORCH_API TimeoutError : public C10dError {
  20. public:
  21. using C10dError::C10dError;
  22. TimeoutError(const TimeoutError&) = default;
  23. TimeoutError& operator=(const TimeoutError&) = default;
  24. TimeoutError(TimeoutError&&) = default;
  25. TimeoutError& operator=(TimeoutError&&) = default;
  26. ~TimeoutError() override;
  27. };
  28. } // namespace c10d