Normalized line endings; tweaked error reporting to show exception class
names
This commit is contained in:
parent
790a1cb56a
commit
610a66220f
|
@ -31,7 +31,8 @@ void reportParsingError(const char* phone_number, const char* msg = "") {
|
||||||
void reportGenericError(std::exception& exception) {
|
void reportGenericError(std::exception& exception) {
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
|
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
|
||||||
errmsg("%s", exception.what())));
|
errmsg("%s", typeid(exception).name()),
|
||||||
|
errdetail("%s", exception.what())));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: handle non-exception thrown types? (shouldn't happen, but you never know...)
|
//TODO: handle non-exception thrown types? (shouldn't happen, but you never know...)
|
||||||
|
@ -98,6 +99,8 @@ extern "C" {
|
||||||
std::string formatted;
|
std::string formatted;
|
||||||
char *result;
|
char *result;
|
||||||
|
|
||||||
|
formatted.resize(20, ' ');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
phoneUtil->Format(*number, PhoneNumberUtil::INTERNATIONAL, &formatted);
|
phoneUtil->Format(*number, PhoneNumberUtil::INTERNATIONAL, &formatted);
|
||||||
} catch(std::bad_alloc& e) {
|
} catch(std::bad_alloc& e) {
|
||||||
|
|
Loading…
Reference in New Issue