2024-10-23 00:46:48 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2018-02-26 18:23:17 +08:00
|
|
|
*
|
2019-06-12 21:46:08 +08:00
|
|
|
* This source code is licensed under the MIT license found in the
|
2018-02-26 18:23:17 +08:00
|
|
|
* LICENSE file in the root directory of this source tree.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// -*- c -*-
|
|
|
|
|
|
|
|
#ifndef FAISS_ERROR_C_H
|
|
|
|
#define FAISS_ERROR_C_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2021-02-25 20:44:50 +08:00
|
|
|
/// An error code which depends on the exception thrown from the previous
|
2019-06-12 21:46:08 +08:00
|
|
|
/// operation. See `faiss_get_last_error` to retrieve the error message.
|
2018-02-26 18:23:17 +08:00
|
|
|
typedef enum FaissErrorCode {
|
2019-06-12 21:46:08 +08:00
|
|
|
/// No error
|
2018-02-26 18:23:17 +08:00
|
|
|
OK = 0,
|
2019-06-12 21:46:08 +08:00
|
|
|
/// Any exception other than Faiss or standard C++ library exceptions
|
2018-02-26 18:23:17 +08:00
|
|
|
UNKNOWN_EXCEPT = -1,
|
2019-06-12 21:46:08 +08:00
|
|
|
/// Faiss library exception
|
2018-02-26 18:23:17 +08:00
|
|
|
FAISS_EXCEPT = -2,
|
2019-06-12 21:46:08 +08:00
|
|
|
/// Standard C++ library exception
|
2018-02-26 18:23:17 +08:00
|
|
|
STD_EXCEPT = -4
|
|
|
|
} FaissErrorCode;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the error message of the last failed operation performed by Faiss.
|
|
|
|
* The given pointer is only invalid until another Faiss function is
|
|
|
|
* called.
|
|
|
|
*/
|
|
|
|
const char* faiss_get_last_error();
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2021-02-25 20:44:50 +08:00
|
|
|
#endif
|