Turi Create  4.0
TuriException.hpp
1 /* Copyright © 2020 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 
7 #pragma once
8 
9 #include <exception>
10 #include <string>
11 
12 #include <core/system/exceptions/TuriErrorCode.hpp>
13 
14 namespace turi {
15 
16 class TuriException : public std::exception {
17  public:
18  TuriException() = delete;
19  TuriException& operator=(const TuriException&) = delete;
20  TuriException& operator=(TuriException&&) = delete;
21 
22  ~TuriException() override;
23 
24  TuriException(const TuriException&);
25  TuriException(TuriException&&);
26 
27  explicit TuriException(TuriErrorCode error_code);
28  TuriException(TuriErrorCode error_code, std::string detail_message);
29 
30  const char* what() const throw() override;
31  const std::string& Message() const;
32 
33  TuriErrorCode ErrorCode() const noexcept;
34  const std::string& ErrorDetail() const;
35 
36  private:
37  const TuriErrorCode error_code_;
38  const std::string detail_message_;
39  const std::string message_;
40 };
41 
42 } // namespace turi
STL namespace.