types: rename why() to what() in exception classes

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
This commit is contained in:
Paweł Dziepak
2015-07-16 14:12:01 +02:00
parent a6d0ed205b
commit 6107c6dd09
4 changed files with 5 additions and 5 deletions

View File

@@ -152,7 +152,7 @@ maps::value::from_serialized(bytes_view value, map_type type, serialization_form
}
return { std::move(map) };
} catch (marshal_exception& e) {
throw exceptions::invalid_request_exception(e.why());
throw exceptions::invalid_request_exception(e.what());
}
}

View File

@@ -115,7 +115,7 @@ sets::value::from_serialized(bytes_view v, set_type type, serialization_format s
}
return value(std::move(elements));
} catch (marshal_exception& e) {
throw exceptions::invalid_request_exception(e.why());
throw exceptions::invalid_request_exception(e.what());
}
}

View File

@@ -152,14 +152,14 @@ class marshal_exception : public std::exception {
public:
marshal_exception() : _why("marshalling error") {}
marshal_exception(sstring why) : _why(sstring("marshaling error: ") + why) {}
virtual const char* why() const { return _why.c_str(); }
virtual const char* what() const noexcept override { return _why.c_str(); }
};
struct runtime_exception : public std::exception {
sstring _why;
public:
runtime_exception(sstring why) : _why(sstring("runtime error: ") + why) {}
virtual const char* why() const { return _why.c_str(); }
virtual const char* what() const noexcept override { return _why.c_str(); }
};
inline int32_t compare_unsigned(bytes_view v1, bytes_view v2) {

View File

@@ -46,7 +46,7 @@ validate_cql_key(schema_ptr schema, const partition_key& key) {
try {
schema->partition_key_type()->validate(b);
} catch (const marshal_exception& e) {
throw exceptions::invalid_request_exception(e.why());
throw exceptions::invalid_request_exception(e.what());
}
}