2018-02-26 18:23:17 +08:00
|
|
|
/**
|
2019-06-12 21:46:08 +08:00
|
|
|
* Copyright (c) Facebook, Inc. and its 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
// -*- c++ -*-
|
|
|
|
|
2021-02-25 20:44:50 +08:00
|
|
|
#include "error_impl.h"
|
2021-02-16 04:40:02 +08:00
|
|
|
#include <faiss/impl/FaissException.h>
|
2021-02-25 20:44:50 +08:00
|
|
|
#include <exception>
|
2018-02-26 18:23:17 +08:00
|
|
|
#include "error_c.h"
|
|
|
|
|
|
|
|
thread_local std::exception_ptr faiss_last_exception;
|
|
|
|
|
|
|
|
const char* faiss_get_last_error() {
|
|
|
|
if (faiss_last_exception) {
|
|
|
|
try {
|
|
|
|
std::rethrow_exception(faiss_last_exception);
|
|
|
|
} catch (std::exception& e) {
|
|
|
|
return e.what();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|