Normalized line endings; tweaked error reporting to show exception class

names
This commit is contained in:
BLM 2015-07-14 15:32:22 -05:00
parent 790a1cb56a
commit 610a66220f
1 changed files with 159 additions and 156 deletions

View File

@ -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) {