MergeError#

class pandas::MergeError#

pandas C++ class.

Example#

#include <pandas/pandas.h>
using namespace pandas;

// Use MergeError
MergeError obj;
// ... operations ...

Constructors#

Signature

Location

Example

explicit MergeError(const std::string& msg) : std::invalid_argument(msg)

pd_exceptions.h:84

View

explicit MergeError(const char\* msg) : std::invalid_argument(msg)

pd_exceptions.h:85

View

Code Examples#

The following examples are extracted from the test suite.

MergeError (pd_test_5_all.cpp:73286)
73276    std::cout << "-- case_9_merge_error_typed_throw\n";
73277    static_assert(std::is_base_of_v<std::invalid_argument, pandas::MergeError>,
73278                  "pandas::MergeError must inherit std::invalid_argument");
73279    static_assert(std::is_base_of_v<std::exception, pandas::MergeError>,
73280                  "pandas::MergeError must inherit std::exception");
73281
73282    // Round-trip via constant.
73283    {
73284        std::string caught;
73285        try {
73286            throw pandas::MergeError(
73287                std::string(pandas::error_messages::kMergeKeysNotUniqueLeftOneToOne));
73288        } catch (const std::exception& e) {
73289            caught = e.what();
73290        }
73291        check_eq_str(
73292            "case_9.MergeError_round_trip_constant",
73293            "Merge keys are not unique in left dataset; not a one-to-one merge",
73294            caught,
73295            local_fail);
73296    }
MergeError (pd_test_5_all.cpp:73286)
73276    std::cout << "-- case_9_merge_error_typed_throw\n";
73277    static_assert(std::is_base_of_v<std::invalid_argument, pandas::MergeError>,
73278                  "pandas::MergeError must inherit std::invalid_argument");
73279    static_assert(std::is_base_of_v<std::exception, pandas::MergeError>,
73280                  "pandas::MergeError must inherit std::exception");
73281
73282    // Round-trip via constant.
73283    {
73284        std::string caught;
73285        try {
73286            throw pandas::MergeError(
73287                std::string(pandas::error_messages::kMergeKeysNotUniqueLeftOneToOne));
73288        } catch (const std::exception& e) {
73289            caught = e.what();
73290        }
73291        check_eq_str(
73292            "case_9.MergeError_round_trip_constant",
73293            "Merge keys are not unique in left dataset; not a one-to-one merge",
73294            caught,
73295            local_fail);
73296    }