Debian Codegraph @

c_api/error_c.h

raw
1 /*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8 // -*- c -*-
9
10 #ifndef FAISS_ERROR_C_H
11 #define FAISS_ERROR_C_H
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 /// An error code which depends on the exception thrown from the previous
18 /// operation. See `faiss_get_last_error` to retrieve the error message.
19 typedef enum FaissErrorCode {
20 /// No error
21 OK = 0,
22 /// Any exception other than Faiss or standard C++ library exceptions
23 UNKNOWN_EXCEPT = -1,
24 /// Faiss library exception
25 FAISS_EXCEPT = -2,
26 /// Standard C++ library exception
27 STD_EXCEPT = -4
28 } FaissErrorCode;
29
30 /**
31 * Get the error message of the last failed operation performed by Faiss.
32 * The given pointer is only invalid until another Faiss function is
33 * called.
34 */
35 const char* faiss_get_last_error();
36
37 #ifdef __cplusplus
38 }
39 #endif
40
41 #endif