MongoDB C++ Driver legacy-1.1.2
Loading...
Searching...
No Matches
exceptions.h
1/* Copyright 2014 MongoDB Inc.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#pragma once
17
18#include <exception>
19#include <string>
20
21#include "mongo/db/jsobj.h"
22#include "mongo/util/assert_util.h"
23
24namespace mongo {
25
29class MONGO_CLIENT_API OperationException : public DBException {
30public:
32 OperationException(const BSONObj& errorObj);
33
35 virtual ~OperationException() throw();
36
38 const BSONObj& obj() const {
39 return _lastError;
40 }
41
42private:
43 const BSONObj _lastError;
44 const std::string _errorString;
45};
46
47} // namespace mongo
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary representa...
Definition bsonobj.h:78
Most mongo exceptions inherit from this; this is commonly caught in most threads.
Definition assert_util.h:87
General runtime exception generated by the MongoDB client driver.
Definition exceptions.h:29
virtual ~OperationException()
Required due to BSONObj member desctructor not specifying throw()
OperationException(const BSONObj &errorObj)
Takes a BSONObj that is the result of the "getlasterror" command.
BSON classes.
Utility functions for parsing numbers from strings.
Definition compare_numbers.h:20