Turi Create  4.0
TuriErrorCode.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 <string>
10 
11 namespace turi {
12 
13 // TuriErrorCodes describe specific error types that don't warrant the creation of custom
14 // TuriException types.
15 //
16 // When adding new error codes, be sure to add human-readable string versions to the
17 // implementation of ErrorCodeToString.cpp.
18 //
19 enum class TuriErrorCode {
20  // generic codes
21  NotImplemented,
22  LogicError,
23 
24  // argument and extent codes
25  IndexOutOfBounds,
26  MissingArgument,
27  InvalidBufferLength,
28  InvalidSize,
29  InvalidDimensionality,
30 
31  // graph codes
32  GraphInputsError,
33  GraphOutputsError,
34  GraphCompilationError,
35 
36  // externally-mapped codes
37  ImageConversionFailure,
38 
39  Unknown,
40 };
41 
42 std::string ErrorCodeToString(TuriErrorCode ec);
43 
44 } // namespace turi