Faiss

- Main Page
- Namespaces
- Classes
- Files

- File List

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
/data/users/matthijs/github_faiss/faiss/FaissException.cpp
1 /**
2 * Copyright (c) 2015-present, Facebook, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the CC-by-NC license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9 // Copyright 2004-present Facebook. All Rights Reserved.
10
11 #include "FaissException.h"
12
13 namespace faiss {
14
15 FaissException::FaissException(const std::string& m)
16 : msg(m) {
17 }
18
19 FaissException::FaissException(const std::string& m,
20 const char* funcName,
21 const char* file,
22 int line) {
23 int size = snprintf(nullptr, 0, "Error in %s at %s:%d: %s",
24 funcName, file, line, m.c_str());
25 msg.resize(size + 1);
26 snprintf(&msg[0], msg.size(), "Error in %s at %s:%d: %s",
27 funcName, file, line, m.c_str());
28 }
29
30 const char*
31 FaissException::what() const noexcept {
32 return msg.c_str();
33 }
34
35 }
faiss::FaissException::what
const char * what() const noexceptoverride
from std::exception
Definition: FaissException.cpp:31